Problem with LAMP

Asked by Wladston Viana

I've just instaled LAMP, and I'm getting this problem:

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Warning: Unknown: Failed opening '/home/wladston/public_html/en/index.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

Anyone can help...?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Lucas Arruda
Solved:
Last query:
Last reply:
Revision history for this message
Lucas Arruda (lucasarruda) said :
#1

Did you tryied giving execution permission for the file?

chmod +x /home/wladston/public_html/en/index.php
(also you can do that on Preferences on your file)

Is the file in the include_path or inside the web root? I think you also need to move it to /var/www/.
Or do something like:

sudo mkdir /var/www/public_html
ln -s /home/wladston/public_html/ /var/www/public_html/

Revision history for this message
Wladston Viana (wladston) said :
#2

I had to give "read" permission to "others" in order to use it...

Tree questions now :
*When I set the "read" permission to "others" on the the public_html folder, it's not applied to all the subfiles. Why ?

*How can the user be prevented from falling into this problem ? (Should this really be an nececcary issue ? On another OS's, I never had such problem ...)

*Should I open another ticket for these two questions ?

Revision history for this message
Dean Sas (dsas) said :
#3

Because you might not want people to be able to read every file inside. I think applying permissions recursively is doable in edgy, but i'm not sure, it is being worked on though.

Until then you could always do chmod -R 774 public_html to give read permission to every file and folder underneath public_html. You could also use umask to make sure every file in there has permissions of 774 by default.

It is setup like this because apache is being ran as another user (www-data I think), Windows doesn't have this problem because usually
 your files are accessible to any other user anyway.

Revision history for this message
Wladston Viana (wladston) said :
#4

If it's being worked on, this is what matters.

Thanks for the hint - but it did not work. I tried with chmod 777 and it worked :)

Maybe this could be rethought to bring more facility to the user - maybe executing apache with the own user ...

Revision history for this message
Lucas Arruda (lucasarruda) said :
#5

Wladston, I would suggest you to create a directory in your home folder (~).

So, you will have the correct permission, without needing to sudo more. And then you chmod 0777 the directory you created.

sudo mkdir /var/www/public_html
ln -s /home/wladston/public_html/ /var/www/public_html/
chmod 0777 /home/wladston/public_html/

Revision history for this message
Wladston Viana (wladston) said :
#6

That was just what I've done. Thanks! :)