LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-31-2004, 07:45 PM   #1
Tsudeki
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Rep: Reputation: 0
PHP errors....


I just got done installing mysql, php and apache and of course it won't go smoothly...

I get the following error anytime I try to access a php page on my server:

Warning: Unknown(/usr/local/apache2/htdocs/index.php): failed to open stream: Permission denied in Unknown on line 0

Warning: (null)(): Failed opening '/usr/local/apache2/htdocs/index.php' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0

I do have the LoadModule set correctly as well as document root and addtype. I've checked around the forums but haven't found much on this :/ At least nothing that helps me >< Thanks in advance.
 
Old 07-31-2004, 07:50 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Looks from the second error like you're trying to include one PHP file into the other (using include or require). Is that the case? If so, does the UID of the file you're including from match the UID of the file you're including? Safe mode makes this a requirement in PHP. If you're not doing inclusion, check the permissions of the PHP file to make sure your apache user can read it. Otherwise check the Apache error_log and see if any more useful info got output there -- it's known to happen on occasion.

Good luck!
 
Old 07-31-2004, 10:29 PM   #3
Tsudeki
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
I'm not sure what you mean my making sure the UID's match since I'm not sure what a UID is...but as far as the other stuff goes, the code for the page is simply:

Code:
<?php
    phpinfo();
?>
:/ I checked the error_log but it had nothing but server start and stop info.
 
Old 07-31-2004, 10:45 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
UID = user ID, your numeric user ID. Anyhow, given the PHP script you posted, that's probably not your problem here. Let's see ... this is a weird error. Did you restart Apache after you had modified its configuration file? When all else fails sometimes I restart the server anyway just to be safe . Also check the permissions on the PHP module itself and make sure that they're the same as all the other Apache modules. Maybe try another PHP script like:

Code:
<?php

echo "<br>Hello...";

?>
in case there's something odd with getting the environment variables in phpinfo ... but this really is a strange error. It sounds like Apache is handing the processing over to PHP (if it was unable to do so, you'd probably get some sort of 500 internal server error from Apache proper) but it's futzing out. Since it reports a problem with /usr/local/lib/php, maybe trying seeinf if that directory exists and has proper permissions.
 
Old 07-31-2004, 11:36 PM   #5
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 837

Rep: Reputation: 201Reputation: 201Reputation: 201
Looks like a rights problem (/usr/local?...). So maybe, the group (apache group) doesn't have rights in the folders or file.

Or maybe make a link (hard or symlink depends on the file system) to '/usr/local/apache2/htdocs/index.php' in /usr/local/lib/php'

Not sure, just starting on apache and php but worked some in other Unixes.

End
 
Old 08-01-2004, 05:11 PM   #6
Tsudeki
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
I've made the folder writeable and executable for all users and groups but I'm still getting the error :/ I'm starting to wonder if it's the text editors but I don't see how that'd be....

Here's a story from yesterday which is interesting:

I decided to move my files for my personal site from one place to another and it went flawlessly (using a third-party server). Then when I created a new file in linux, (the others were made in windows), that file gives that same error that my own file server uses. So I'm going to test one of the files from my other site to see if it runs on the linux server, if so, I can assume it's the text editor, right? Or is it something else still ><
 
Old 08-01-2004, 05:15 PM   #7
Tsudeki
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Hate to post twice in a row, but the above experiment turned out the way I expected. The files made in windows worked. So localhost/index.php doesn't work, but localhost/test/index.php works fine. .... I would REALLY hate to have to do all this in windows T_T

Another interesting note:

dos2unix on index.php (the one that worked) made it stop working. It now produces the above error....

Last edited by Tsudeki; 08-01-2004 at 05:18 PM.
 
Old 08-01-2004, 05:21 PM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,284

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
That's weird, I wonder if unix2dos on the non-working files would magically make them work...
 
Old 08-01-2004, 05:46 PM   #9
Tsudeki
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Way ahead of ya ^^; Unfortunately it didn't work I'm trying different text editors, if all else fails I will just be doing it all in windows
 
Old 08-01-2004, 08:13 PM   #10
Tsudeki
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
Okay, this is what I've come up with:

To fix this error, do one of two things:

Do all the editing in windows, and use linux for hosting since gedit adds chars at the beginning of the file that makes php not wanna work with it (or at least it is so with my fedora build o_O)...OR...use OpenOffice and save as .txt and then open in gedit and delete the first char (it will be invisible, but it's there). And voila, it works.

Hopefully this is resolved with this, and maybe if someone else can't get passed this error this will help @_@...but anyway, this is what works for me

Thanks to everyone who looked at this and made an effort to help out (even if you didn't reply that you were trying to figure it out). ^_^
 
Old 08-01-2004, 08:16 PM   #11
Longinus
Member
 
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420

Rep: Reputation: 30
you might want to take a look at the httpd.conf file in your apache config directory
 
Old 08-02-2004, 06:38 AM   #12
Tsudeki
LQ Newbie
 
Registered: Jul 2004
Posts: 14

Original Poster
Rep: Reputation: 0
I guess you didn't read all the posts in this thread before replying (this has been fixed)@_@ But just in case you did read them all, what would I be looking for that would cause/prevent this error w/o having to use the method I found.
 
Old 08-02-2004, 06:45 PM   #13
Longinus
Member
 
Registered: Sep 2003
Distribution: Redhat 9.0 && Slackware 9.1
Posts: 420

Rep: Reputation: 30
i remember something about including a php mod file in the httpd.conf file

lol, and sorry about the late info, in the three minutes i posted after you said it was fixed i was reading the other posts, forgot to refresh lol

Last edited by Longinus; 08-02-2004 at 06:46 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
errors in php/mysql skybell Slackware 13 11-11-2005 10:59 PM
PHP (cgi) errors Maze the Kid Linux - Software 2 05-02-2005 03:52 PM
Send errors via PHP RodimusProblem Programming 1 02-07-2005 09:37 AM
PHP 5.0.0 Compile Errors jon_k Linux - Software 0 08-04-2004 07:10 PM
php won't display errors Red Squirrel Linux - Software 4 03-14-2004 01:28 PM


All times are GMT -5. The time now is 09:03 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration