Results 1 to 3 of 3

Thread: Include php file from another server

  1. #1
    Join Date
    Mar 2009

    Include php file from another server


    I've been working on a simple cms of sorts only to be hit by a fairly large problem. I've been working on the basis that I would be able to reference php files on a single server from any other server using a simple line such as

    PHP Code:
    however it seems this is not as easy as it seems, due to security measures taken by many hosting companies to prevent php access to outside files, resulting in the warning

    "Warning: include() [function.include]: URL file-access is disabled in the server configuration in www.mydomain.com/user/htdocs/index.php on line 7"

    Having done a bit of research I came across the potential solution of adding the following line to my code

    PHP Code:
    However this hasn't worked either.

    I am quite new to php, so my knwoledge isn't particularly extensive. I'm assuming I won't be able to make this work, so I guess what I really want to know is, is there an alternative to the "include()" php function that might work for me?

  2. #2
    Join Date
    Aug 2004
    allow_url_fopen and allow_url_include cannot be changed at run-time. If they could, it would pretty much negate the security function such a restriction has. (The issue here is that including something from a remote server can have extremely serious security problems if you do not have 100% control/confidence in the code being included from that server.) Additionally, if you include a .php file from a remote server and that server processes it locally as PHP, all your including file will receive is the output of that script, not the source code as you would when including a file from the local file system.

    Without knowing the exact details as to why you are doing this and what exactly is to be included, I'm not sure what the best answer is (besides "don't do that"?). Worst case: grab the file via cURL or FTP and then (*shudder!*) eval() it.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Mar 2009
    Basically I'm a website designer and I recently got into a bit of php and decided to attempt to make a simple template system that I would eb able to set up for anyone. Once I got the hang of the php I realised I could possibly produce all the central files just once, and then simply upload a single php page to the clients' servers that would reference the many other files needed, as well as detailing which database to get the content from.

    The advantage would be that I could continue to update and improve the template system and any changes I made would appear automatically on all clients' websites using the system, as well as only having to give the clients a single file to upload to their domains, thus also protecting the code I've written and preventing anyone from making changes to this. The client would also then have their domain in the title bar, rather than referencing my domain instead.

    Perhaps I can make my the client pages act as a frame for the central index.php template file (iframe?) and simply pass the variables of which database to get the data from that way, or some such possible alternative if it exists?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.33335 seconds
  • Memory Usage 2,853KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates