Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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 ><
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....
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). ^_^
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.