homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

include command and php.ini problems
include, php.ini

Msg#: 4459941 posted 3:54 pm on May 31, 2012 (gmt 0)

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:

register_globals = On

allow_url_fopen = On

allow_url_include = On

But this has no effect.

Any ideas?

Many thanks



Msg#: 4459941 posted 6:15 pm on May 31, 2012 (gmt 0)

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.

I therefore thought that if I put

AddType application/x-httpd-php .html .htm

it just tries to download a file!

Oh happy days!



WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

Msg#: 4459941 posted 8:31 pm on May 31, 2012 (gmt 0)

AddHandler in place of or in addition to AddType.

register_globals = On is probably a bad idea.

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4459941 posted 11:31 pm on Jun 1, 2012 (gmt 0)


This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved