Reputation: 371
I have many HTML files which use PHP. I remedy this by using the .htacess code ...
AddType application/x-httpd-php .php .html .htm
... and it works fine (in most cases).
I use a browser sniffer to detect which browser my users are using and if they don't use IE then I display a navigation bar. the code is here ...
include('http://domain/browser.php'); $browser = new Browser(); if( $browser->getBrowser() == Browser::BROWSER_IE) { } else{ include('http://domain.com/bottom-nav.php'); }
All of this worked fine before but I just did a server transfer and now only this PHP code breaks, giving me this error.
Warning: include_once() [function.include-once]: URL file-access is disabled in the server configuration in /home/myname/public_html/index.html on line 359
Upvotes: 2
Views: 170
Reputation: 12727
Most likely the php.ini of the new server is configured with allow_url_fopen = off
or allow_url_include = off
. That's why.
Upvotes: 4
Reputation: 11724
The include()
function of PHP can read files locally on your server, or in your case, from a remote server via HTTP. For security reasons some system administrators will disable that feature in PHP's configuration so include()
can only work for local files on your server.
If the file you are including is indeed part of your existing website then use a local path instead of a remote path. For example:
include('/path/to/website/browser.php'); $browser = new Browser(); if( $browser->getBrowser() == Browser::BROWSER_IE) { } else{ include('/path/to/website/bottom-nav.php'); }
Otherwise you will need to contact your system administrator and have the feature enabled.
Hope that helps
Upvotes: 3