Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/ 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/' (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?

share|improve this question
I have made paste the total file of in this link – newuser Aug 22 '13 at 4:57
strange..When I tried ls /var/www/Prestashop/config/ in terminal it is showing ls: cannot access /var/www/Prestashop/config/ No such file or directory but I have checked the file is exist there – newuser Aug 22 '13 at 5:32
Good. :) Please post output of: ls /var/www/Prestashop/config/ – saji89 Aug 22 '13 at 5:33
Again the strange error .. ls /var/www/Prestashop/config.php it showed me ls: cannot access /var/www/Prestashop/config.php: No such file or directory – newuser Aug 22 '13 at 5:36
Try ls /var/www/Prestashop/config/ and the not the one you tried above. – saji89 Aug 22 '13 at 5:46

The error is produced by require() function. This function it will halt the php script when:

  • the given file (in your case /var/www/Prestashop/config/ file) doesn't exist or
  • when the user that call the function doesn't have permission to read that file.

According with:

Warning: require(/var/www/Prestashop/config/ failed to open stream: Permission denied in /var/www/Prestashop/index.php on line 27

your issue falls into the second case. To prevent this, you have to change the permissions for /var/www/Prestashop/config/ file so that to allow other users to read the file. You can do this by running the following command from terminal:

chmod +r /var/www/Prestashop/config/

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:

chmod +rx /var/www/Prestashop/config
share|improve this answer
I don't think thats a good solution because by changing the file permission config or is not solving the issue. I had gone through many forums and someone of them had told to change the folder and files permission. But that's a very ugly method. Applications do have some access for their files and folders and they have done that for the security. And by the way I had done simple installation before this time and at that time I did not changed any permission for files or folders. – newuser Aug 23 '13 at 9:19
@newuser Well, if you don't change permission for others to read that file, how do you suppose to read the file? There is no other solutions in unix like systems... Is not an ugly method, it's the usual method. – Radu Rădeanu Aug 23 '13 at 9:40

Permissions on directory /var/www/Prestashop/config are wrong. They are drwx------ meaning that ONLY the newuser user can access them. The webserver is run as www-data and obviously it can't access your config directory.

There's absolutely no harm at adding read permissions to both group and all.

chmod +rx /var/www/Prestashop/config

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

sudo chown www-data /var/www/Prestashop/config

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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.