Results 1 to 2 of 2

Thread: php include file

  1. #1
    Join Date
    Jul 2005
    faisalabad, punjab, pakistan

    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
    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.
    "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

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