T
T
Tarrissarh2018-05-03 15:23:06
PHP
Tarrissarh, 2018-05-03 15:23:06

How to make a separate php.ini for each project on Ubuntu?

There are several different projects (based on Bitrix, Wordpress, Symfony, for example).
Bitrix needs to activate some settings that are not needed in others (for example, short_tag).
Is it possible to do something so that the Bitrix project has its own php, wordpress has its own and symfony has its own?
And so that either everyone can work at the same time, or with the help of a script you can quickly switch to the necessary configs (for example, using a script, you can quickly and without any dances change the version of php, I would like it to be the same in this case).
Is it all possible or pipe dreams?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Merzley, 2018-05-03
@Tarrissarh

Agree with the previous answer about docker. But if you still want to get by with configs, then in Apache this is done quite simply. In nginx too, I just won’t write how right off the bat. In general, for Apache:
A separate VirtualHost is made for each project with a separate config in the /etc/apache2/sites-available folder. And for each VirtualHost`a, you can write changes to the standard PHP config. These changes will only apply to requests to this VirtualHost.
Here is what I had written for Bitrix:

php_admin_flag short_open_tag On
        php_admin_value opcache.revalidate_freq 0
        php_admin_value mbstring.func_overload 2
        php_admin_value mbstring.internal_encoding UTF-8
        php_admin_value max_input_vars 10000
        php_admin_value upload_max_filesize 5M

To change the PHP version, it is enough to disable the Apache module with one version, and connect it with another one:
sudo a2dismod php7.2 && sudo a2enmod php7.0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question