I have 2 pretty much identical files file1.php, file2.php.
All files and the includes are located in the same website folder.
When I do include("header.php") from file1.php everything works fine.
However, none of the includes in file2.php work, giving me the following errors:
Warning: include(header.php) [function.include]: failed to open stream: Operation not permitted in /var/www/vhosts/...../file1.php on line 20
Warning: include() [function.include]: Failed opening 'header.php' for inclusion (include_path='.:') in /var/www/vhosts/...../file1.php on line 20
Warning: mysql_query() [function.mysql-query]: Access denied for user 'apache'@'localhost' (using password: NO)
But file2.php is pretty much the same file as file1.php ! And it's in the same folder too!
Also mysql won't work. All the files are in the same folder. I tried setting all permissions to 777 -- does not make any difference. What seems to make a difference is when I rename header.php to header2.php and changed the include to include header2.php. It just seems really strange. I do not want to make 2 copies of all my includes!
The include path is set to .
includes not working -- really strange, php bug?
Moderator: General Moderators
-
phpguy9999
- Forum Newbie
- Posts: 4
- Joined: Sun Aug 15, 2010 6:44 pm
-
phpguy9999
- Forum Newbie
- Posts: 4
- Joined: Sun Aug 15, 2010 6:44 pm
Re: includes not working -- really strange, php bug?
Also sometimes I was getting this error too (I think when I specified an absolute root-based path)
"The script whose uid is 0 is not allowed to access owned by uid 2345"
"The script whose uid is 0 is not allowed to access owned by uid 2345"
-
phpguy9999
- Forum Newbie
- Posts: 4
- Joined: Sun Aug 15, 2010 6:44 pm
Re: includes not working -- really strange, php bug?
I realized that I can resolve the issue by copying a file to my Windows computer through FTP, then copying the file on Windows, then deleting the original file via FTP and uploading a fresh copy. I still do not understand why this has to be done, and why changing the permissions to 777 does not work. I would like to get to the bottom of why this is happening.
-
phpguy9999
- Forum Newbie
- Posts: 4
- Joined: Sun Aug 15, 2010 6:44 pm
Re: includes not working -- really strange, php bug?
haha! I think I got to the bottom of this finally. I was uploading files under root account, so they ended up having Root as the owner, while the includes had somebody else as the owner. Even though I have set the permissions to 777 on all includes the problem only resolved itself when I went into Plesk( which actually allows me to change the owner back from the Root) and changed the file owners. (my Core FTP LE client does not do it)