file … failed to open stream: Permission denied

2019-07-21 08:15发布

问题:

I am coping a site for a client, I've clones the whole site on my server and it seem to work. now that I've copied the site over to his server and trying to make a payment (using paypal pro) i get a permission error:

`Warning: error_log(../PayPal.log) [function.error-log]: failed to open stream: Permission denied`

I've tried changing the permissions to 777 for everything and this error keep coming.

I've have looked around, in google and in here i saw that it might have something to do with php settings (safemode or open_basedir) but when i check phpinfo() its seems safemod is disabled and open_basedir is empty.

anyone with an idea ?

回答1:

Update

While adding any virtual host (or even single host) you must set a DocumentRoot within Apache. That directive tells apache where to look for the files and map the root of the website.

DocumentRoot "/var/www/vhosts/www.example.com"

But that directive alone doesn't give access to client to read/write that directory. You must specify the configuration for that directory, like.

<Directory "/var/www/vhosts/www.example.com">
      Options Indexes FollowSymLinks
      AllowOverride All
      Order allow,deny
      Allow from all 
</Directory>

if your Document root (within this example) is /var/www/vhosts/www.example.com apache would need to have write/execute access to /var/www/vhosts/ and /var/www/vhosts/ would need to be configured within apache.


Okay.

I believe that if everything is 777 the problem is most likely related to open_basedir or/and directive for apache.

Make sure that ../Paypal.log is accessible within apache and open_basedir. Also bear in mind what else is within that ../ scope and how it will impact your security.