LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-17-2008, 01:19 AM   #1
chus_84
Member
 
Registered: Feb 2007
Posts: 38

Rep: Reputation: 15
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.
 
Old 07-17-2008, 01:45 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
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
 
Old 07-17-2008, 02:00 AM   #3
chus_84
Member
 
Registered: Feb 2007
Posts: 38

Original Poster
Rep: Reputation: 15
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.
 
Old 07-17-2008, 06:11 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
are you sure that you have changed the permissions of the common directory?
 
Old 07-17-2008, 11:53 PM   #5
chus_84
Member
 
Registered: Feb 2007
Posts: 38

Original Poster
Rep: Reputation: 15
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.
 
Old 07-18-2008, 08:44 AM   #6
FranDango
Member
 
Registered: Jun 2008
Posts: 101

Rep: Reputation: 15
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

Last edited by FranDango; 09-20-2008 at 05:37 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Yrch! "path" Parameter Handling Remote PHP File Inclusion ... LXer Syndicated Linux News 0 12-29-2006 11:33 PM
File inclusion vulnerabilities coolb Linux - Security 1 05-20-2006 08:51 PM
php session - works with warning !!! prabhatsoni Linux - Software 2 06-02-2005 11:45 PM
.h File Inclusion in C++ Hady Programming 6 05-31-2005 08:24 PM
Failed opening '../main/mainconfig.php' for inclusion (include_path='.:/usr/local/lib ryancoolest Linux - Newbie 3 09-29-2004 09:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration