[BlueOnyx:21639] Re: Issue with PHP on site

Michael Stauber mstauber at blueonyx.it
Fri Jan 5 14:58:36 -05 2018


Hi Lee,

> I’m having some issues with a new site, effectively the site will not load properly.
> 
> The error_log shows:
> 
> [Fri Jan 05 12:27:31 2018] [warn] [client 82.113.187.117] PHP Warning:  file_put_contents(/home/.sites/106/site3/web/runtime/debug/5a4f6f32cd94a.data): failed to open stream: Permission denied in /home/.sites/106/site3/web/vendor/yiisoft/yii2-debug/LogTarget.php on line 64
> [Fri Jan 05 12:27:31 2018] [warn] [client 82.113.187.117] PHP Warning:  touch(): Utime failed: Permission denied in /home/.sites/106/site3/web/vendor/yiisoft/yii2-debug/LogTarget.php on line 82

This is a permission issue. The Apache webserver is running PHP with an
uid/gid which doesn't allow it to create (or modify) files in this
Vsites webspace.

Here is how to fix it:

- Make sure the Vsite has a "siteAdmin" and that this siteAdmin has
enough disk-quota.

- Under "Site Management" / <VSITE> / "Services" / "Web Ownership"
change the "SiteAdmin that owns /web:" from "apache" to the siteAdmin
that has enough disk quota to own /web. Save the changes. This will
chown /web to the UID/GID of that siteAdmin.

- Under "Site Management" / <VSITE> / "Services" / "Web" change "Enable
PHP Scripting" to a PHP implementation that allows to execute PHP
scripts as the owner of the scripts.

On 5207R or 5208R this is "suPHP".

On 5209R you do have more options for PHP implementations that allow this:

- PHP (DSO) + mod_ruid2
- suPHP
- FPM/FastCGI

FPM/FastCGI is the fastest and suPHP the slowest option.

> allow url fopen and allow url include

allow_url_include is the worst thing you can do. It creates a horrible
security issue and opens your scripts to exploits.

Likewise usage of file_put_contents() isn't is discouraged by security
minded programmers. You can use cURL to grab remote files and can use
fopen() to save them locally.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list