Msg#: 4459941 posted 3:54 pm on May 31, 2012 (gmt 0)
Help. We have a managed dedicated server that has just been updated to Apace2 and PHP 5.2.17. (Originally PHP 4.4.9 which is still there).
We use the include command on our .php pages and also have a line in .htaccess file to run the include command in our .htm pages. Everything was working fine until the upgrade.
In the .htaccess file we have ben told to use the following line AddHandler x-mapp-php5 .htm
Everything is working okay but for the inclusion of RSS feeds that we obtain from licenced 3rd party websites. These inclusions work okay on .php pages but not on the .htm pages.
This is the error message we get :
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /homepages/46/d69851822/htdocs/#*$!x.com/index.htm on line 29
Warning: include(http://www.#*$!x.com/rssbuild/rss2html.php?XMLFILE=http://feeds.#*$!.co.uk/news/rss.xml&TEMPLATE=http://www.#*$!xo.com/rssbuild/template.html&MAXITEMS=10) [function.include]: failed to open stream: no suitable wrapper could be found in /homepages/46/d69851822/htdocs/#*$!x.com/index.htm on line 29
Warning: include() [function.include]: Failed opening 'http://www.#*$!x.com/rssbuild/rss2html.php?XMLFILE=http://feeds.#*$!x.co.uk/news/rss.xml&TEMPLATE=http://www.#*$!xx.com/rssbuild/template.html&MAXITEMS=10' for inclusion (include_path='.:/usr/lib/php5') in /homepages/46/d69851822/htdocs/#*$!xx.com/index.htm on line 29
I have been told to put a php.ini file in the directory with just the following lines of text to override the main php.ini file:
Msg#: 4459941 posted 6:15 pm on May 31, 2012 (gmt 0)
The allow_url_include was added in PHP 5.2 and defaults to off, which is probably why your includes fail after the upgrade.
If you regularly use URLs in your includes, you might want to consider turning allow_url_include on in PHP's main configuration file. If you only use for a few of your projects or don't have access to the configuration file, you can turn it on per-directory using an .htaccess file. That file should include the following line:
php_flag allow_url_include on
Edit: Missed this part...
These inclusions work okay on .php pages but not on the .htm pages.
That's a little weird. There might be something else to this, but try the above first.
Edit #2: Actually, if possible, create a .htm file and a .php file. Put a call to phpinfo()...
<?php phpinfo(); ?>
...in both and see if there are any differences. This might give you a clue.
Msg#: 4459941 posted 7:33 pm on May 31, 2012 (gmt 0)
Many thanks for the quick reply.
I put php_flag allow_url_include on in the .htaccess file and it returned an Internal Server Error.
I removed that and then put <?php phpinfo(); ?> onto two pages, one .htm and the other .php
It would appear that because of the line in the .htaccess file AddHandler x-mapp-php5 .htm the .htm is using php 5.2.17 and is not working correctly i.e giving the error mesages as I indicated. whereas the .php file is using PHP 4.4.9 and is working correctly.
Iam unable to change the php.ini file but the service provider said to use a local php.ini file in the directory of the .htm pages, but of course this dosen't work.