www.webdeveloper.com
Results 1 to 2 of 2

Thread: php include file

  1. #1
    Join Date
    Jul 2005
    Location
    faisalabad, punjab, pakistan
    Posts
    241

    php include file

    is it possible to include file hosted at another server using include() function of php,

    my problem is that i have a general functions files hosted at another server, now want to access that function on another server,

    is it possible to call those function ?????

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,227
    It is possible, but if it is a .php file and that server runs PHP, then when you include it all you will get is the output of that file when you include it, not the actual PHP code like you do when you include a file locally. You can get around this by naming the file with a suffix such as .txt or otherwise configuring the server to serve it up as plain text without any other processing.

    However, be aware that this can be a security hazard. If that one file is somehow compromised, every script that includes it will now be at risk of executing any code injected into or replacing that file; and perhaps more of an issue is that the file will, by definition, have to accessible to the internet, and that might not be very desirable.

    Also, if you do not have control over the host configuration, you may not be able to do it anyway since it is common to disable the allow_url_include option.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

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



Recent Articles