[BlueOnyx:20744] Re: PHP Defaults

Michael Stauber mstauber at blueonyx.it
Wed Mar 1 10:57:39 -05 2017


Hi Jochen,

> we are running blueonyx 5209R. For every new customer we need to adjust
> php values like max_execution_time, memory_limit and some more.
> I have some questions regarding that.
> 
> 1) How can we set different default values so that every newly created
> virtual sites uses these values?

In the GUI interface under "Server Management" / "Security" / "PHP
Settings" you can set the global values for PHP that apply to all new
Vsites. The common things like upload max filesize, memory related
things and execution time are editable there.

When you then create a new Vsite, that Vsite will use the new defaults.

Should a Vsite need different values? No problem Go to the Vsite in
question and under "Services" / "PHP" you can make individual changes to
this Vsite's PHP settings.

> 2) What about the values that cannot be set in WebGUI?

There are several ways how this can be done. For starters you could edit
the global php.ini that comes with the PHP. Now each PHP package (and
the "stock" PHP that comes with 5209R) have their own php.ini:

System PHP: /etc/php.ini
Solarspeed PHP: /home/solarspeed/php-<version>/etc/php.ini

You can edit these. After such an edit of these files it's a good idea
to restart CCEd, though:

/usr/sausalito/sbin/cced.init restart

However: Vsites that use suPHP have their own php.ini in the home
directory of the Vsite. For this the php.ini of the used PHP version is
copied to the home directory of the Vsite and then the Vsite related PHP
changes are made to it to write the correct memory and execution limits
into it.

This Vsite php.ini is protected against user-modifications with "chattr
+i", so even "root" cannot edit it. Unless you use "chattr -i" on it first.

So if you have a Vsite that uses suPHP and you edited the "master"
php.ini of the package? Disable suPHP for that Vsite, save and turn
suPHP on again. In that case your modifed php.ini will be copied over
and the rest of the changes (memory and execution time and other GUI
editable values) will be adjusted.

On 5209R we also do have a php.d mechanism in place that allows you to
include alternate Settings in /home/sites/<sitename>/php.d/<yourfile>.ini

But please note: Although you can put your own *.ini files in there: The
format of the data in it needs to be in Apache style and not php.ini
style. Example:

php_flag display_errors Off
php_flag log_errors On
php_value upload_max_filesize 5M
php_value post_max_size 6M
php_value memory_limit 64M

Lastly: Certain PHP configurational (such as shown above) can be set on
a per Vsite basis either via a .htacces or by adding lines to the Apache
config file of the Vsite. Say you want to add something to the Apache
config of site1? Then you would edit this file:

/etc/httpd/conf/vhosts/site1.include

Again: The format for both .htaccess and direct edits of the Apache
config need to be in the style as shown above via "php_flag" or "php_value".

> 3) We also plan to buy the PHP package that offers us to choose from
> several PHP versions for our customers. What will change when we install
> this addon?

On 5209R you can install multiple PHP packages at the same time. So you
can have these PHP PKGs all at once:

- PHP 5.4
- PHP 5.5
- PHP 5.6
- PHP 7.0
- PHP 7.1

For every Vsite that uses either suPHP or PHP-FPM you can then choose
individually which PHP version it should use.

We all know how it goes: Anything older than PHP-5.6 is End-of-Life and
shouldn't be used anymore. But lots of people are still using older
scripts that won't run on still supported PHP versions. So you can
easily set them up to use an older PHP now and whenever they need a
different one you can change it with just a few clicks in the GUI.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list