LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP file inclusion warning (https://www.linuxquestions.org/questions/programming-9/php-file-inclusion-warning-656295/)

chus_84 07-17-2008 01:19 AM

PHP file inclusion warning
 
Hello,

I have installed LAMP Server on Ubuntu 7.10. And I have edited the file available in /etc/apache2/sites-enabled/000-default, changing document root form /var/www to /home/guest/www and then I restarted the server and started executing the my PHP files, I got the following error/warning
Quote:

Warning: include(common/header.php) [function.include]: failed to open stream: Permission denied in /home/guest/www/index.php on line 1

Warning: include() [function.include]: Failed opening 'common/header.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/guest/www/index.php on line 1

Warning: include(common/footer.php) [function.include]: failed to open stream: Permission denied in /home/guest/www/index.php on line 2

Warning: include() [function.include]: Failed opening 'common/footer.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/guest/www/index.php on line 2
Files are available in the folder and I changed the permissions to 777, but still I am not able to execute. Please help me.

graemef 07-17-2008 01:45 AM

First changing a folders permission to 777 is never advisable...

is common/footer.php in the path given if not then correct the path is so then I would suspect that the web server Apache doesn't have permission to a parent folder /home/guest

chus_84 07-17-2008 02:00 AM

PHP Warning
 
Hello,

Thank You for the reply. My www folder contains folders common, configure, pics, css and javascripts along with my index.php file. index.php file contains the code
Quote:

<?php include("common/header.php");?>
<?php include("common/footer.php");?>
. I have changed the permissions to 775, thanks for the advice. Still I am not able to execute my index.php. I am getting the same warnings.

graemef 07-17-2008 06:11 AM

are you sure that you have changed the permissions of the common directory?

chus_84 07-17-2008 11:53 PM

PHP warining
 
Hello,

Thanks for the reply. I have changed the file permission to 755 to all folders and files. Still I am not able to include files.

FranDango 07-18-2008 08:44 AM

The web server needs access permission for all parent directories on path /home/guest/www. I assume that 'guest' is a user's home directory (user guest), so you probably have to add user 'apache' to the 'guest' group, or make some sudo settings that have a similar effect.

Anyway, my advice would be to reset webroot to /var/html and rather create the 'guest' home directory within /var/html. In httpd.conf set up a virtual host with the guest home directory or one of it's subdirectories as the webroot for that given virtual host.

Linux Archive


All times are GMT -5. The time now is 06:49 PM.