Page 1 of 1

php installation error in ubuntu

Posted: Fri Sep 11, 2009 5:33 pm
by lipun4u
I have recently shifted from windows to ubuntu.

I have successfully installed php+apache by following steps..
sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo /etc/init.d/apache2 restart
Now I put a file known as script1.php in /var/www/ folder which contains

Code: Select all

 
<?php
 
print "hello World";
 
?>
 
But when tried in the address bar http://127.0.1.1/script1.php
it gave me following problem...
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required '/var/www/script1.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

Re: php installation error in ubuntu

Posted: Fri Sep 11, 2009 7:23 pm
by requinix
Does /var/www have read and execute permissions for the right user/group? (I think it runs as apache, wheel, or www-user.) How about script1.php?

Re: php installation error in ubuntu

Posted: Fri Sep 11, 2009 7:26 pm
by VladSun
What is the output of:

Code: Select all

ls -l /var/www/script1.php

Re: php installation error in ubuntu

Posted: Fri Sep 11, 2009 9:01 pm
by lipun4u
Ya I got this

I gave the rwx permission on the file.

Is this possible to automate this procedure or change the default permission of all files created in this /var/www/ folder ???

Re: php installation error in ubuntu

Posted: Fri Sep 11, 2009 10:17 pm
by requinix
Your umask should be 0022, so new directories should automatically be 0755 and new files will be 0644.

Create a new PHP file, make sure that it doesn't work (with the same problem as before) then do as VladSun asked - but replace the script1.php with whatever the new file was named.