I have two directories in /var/www
:
root@user:/var/www# ls -l
drwxrwxrwx 2 root root 4096 Июл 14 17:59 first
drwxrwxrwx 2 root root 4096 Июл 14 18:00 second
with exactly the same php scripts:
root@user:/var/www# ls -l first/
-rwxrwxrwx 1 root root 20 Июл 14 16:37 info.php
root@user:/var/www# ls -l second/
-rwxrwxrwx 1 root root 20 Июл 14 16:37 info.php
info.php:
<?php
phpinfo();
?>
But from the first/
directory Apache opens script, from the second/
pulls error:
( ! ) Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
( ! ) Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
( ! ) Fatal error: Unknown: Failed opening required '/var/www/second/info.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
What can be a reason?
Directory config:
DocumentRoot "/var/www"
<Directory "/var/www">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
You're just opening your php file into browser. You have to open it using localhost url. if you open a file directly from your directory it will not execute the php code in any case. Enable php short code.
The most common reason for a blank page is that the script is missing a character. If you left out a ' or } or ; somewhere, your PHP won't work. You don't get an error; you just get a blank screen.
You need to change the owner of the two folders from 'root' to apache.
Try sudo chown -R [yourusername]:www-data /var/www
This should help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With