I am using LAMP server on my Ubuntu 12.04 system. Before this time I have installed prestashop without any issues. But after a long time when I tried to install prestashop today, it really showed me a strange error. The error is like this:
Warning: require(/var/www/Prestashop/config/config.inc.php): failed to open stream: Permission denied in /var/www/Prestashop/index.php on line 27 Fatal error: require(): Failed opening required '/var/www/Prestashop/config/config.inc.php' (include_path='.:/usr/share/php:/usr/share/pear/PEAR') in /var/www/Prestashop/index.php on line 27
For that I decided to debug the error so I went through many blogs and forums and I checked my php.ini file. The file is like this.
After going through many blogs someone had said that the error is for php pear package the link is here.
After that I just made edit my php.ini pear url like this:
;UNIX: "/path1:/path2"
include_path = ".:/usr/share/php:/usr/share/php/PEAR"
After that I just restarted my apache server but it did not worked for me. The same error is coming. So here can someone kindly tell me what's the issue here? and how to solve this?
The error is produced by
require()
function. This function it will halt the php script when:/var/www/Prestashop/config/config.inc.php
file) doesn't exist orAccording with:
your issue falls into the second case. To prevent this, you have to change the permissions for
/var/www/Prestashop/config/config.inc.php
file so that to allow other users to read the file. You can do this by running the following command from terminal:If the error will appear after for other files too, follow the same method to change the permissions.
Check also the permissions for
config
directory. These must to be something like:drwxr-xr-x
. If not, use this command in terminal:Permissions on directory
/var/www/Prestashop/config
are wrong. They aredrwx------
meaning that ONLY thenewuser
user can access them. The webserver is run aswww-data
and obviously it can't access your config directory.There's absolutely no harm at adding read permissions to both group and all.
It might be considered a security issue adding write permission to the directory, but also this is disputable since
/tmp/
is always accessible and malicious software tends to use that as a support directory.Of course don't give write access to the files themselves as that would be a security issue.
If you really don't want to make it readable to the world you can change the owner to
www-data
that should be enough since files inside the directory are world readable (except for the
xml
folder that again needs the right ownership or permissions).