# php include/require path



## twmprys (Jun 4, 2009)

Anyone else had this problem? I've got a CMS which creates a new page for each new member of a society. For each new member page, I want to include menu information which is sotred on a separate page. When I view the newly created pages which have a php 'include' instruction, the menu is absent. When I change the script to write the instruction 'require', I get a fatal error - Failed opening required 'menu.php' (include_path='.:/usr/share/pear') -. Trouble is, because the pages are seen as belonging to Apache, I can't get into them to find out what the script has written.


----------



## briealeida (Jun 3, 2007)

Hello.

What are the contents of your .htaccess file?

Have you recently updated PHP?

I had possibly the same problem today. Adding the following to my .htaccess worked:

php_flag allow_furl_open on
php_flag allow_url_include on

Do you have root access to the web server? If not, maybe you should contact your hosting company. .


----------



## twmprys (Jun 4, 2009)

Thanks very much for the hint. I'll contact my hosting company and report back if I get any joy!


----------



## twmprys (Jun 4, 2009)

The tell me it's nothing to do with .htaccess

Oh dear!


----------



## MMJ (Oct 15, 2006)

might wanna echo getcwd()


----------



## Eriksrocks (Aug 7, 2005)

briealeida said:


> Adding the following to my .htaccess worked:
> 
> php_flag allow_furl_open on
> php_flag allow_url_include on


These are dangerous options that could allow someone to include remote PHP code if they can find a security hole in your scripts. Make sure your scripts are 110% secure before turning these on. They should not be needed for including files on the local server, anyway. 



twmprys said:


> When I change the script to write the instruction 'require', I get a fatal error - Failed opening required 'menu.php' (include_path='.:/usr/share/pear') -. Trouble is, because the pages are seen as belonging to Apache, I can't get into them to find out what the script has written.


Something is wrong with the configuration of your PHP installation. Try changing the include (or require) path to "./menu.php".


----------

