1

I got a server that runs : PHP Version 5.5.9-1 ubuntu 4.9

I wanted to edit the "correct" php.ini file so i can enable some features. First of all i used:

root@server ~ # find / -name php.ini

/opt/psa/admin/conf/php.ini
/opt/plesk/php/5.3/etc/php.ini
/opt/plesk/php/5.5/etc/php.ini
/opt/plesk/php/5.4/etc/php.ini
/opt/plesk/php/5.6/etc/php.ini
/var/www/vhosts/system/mysiteyo/etc/php.ini
/etc/php5/cgi/php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
/etc/psa-webmail/horde/horde/php.ini
/etc/psa-webmail/roundcube/php.ini

I read from a previous thread that I should edit the /etc/php5/apache2/php.ini file.

I also created a phpinfo(); script and run it from my browser. The configuration file Path @ phpinfo was the /etc/php5/cgi/php.ini but the loaded configuration file was :

/var/www/vhosts/system/mysiteyo/etc/php.ini 

As I opened the above file, I saw this:

; ATTENTION! ;  
; DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY, 
; SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

So I thought that this file is somehow generated from one of the other php.ini files.

Then i renamed both files (/etc/php5/cgi && /etc/php5/apache2) as php_tmp.ini and loaded my new modified php.ini file.

After that i restarted apache2:

root@server ~ # /etc/init.d/apache2 restart

Although as i rerun the phpinfo(); script, I can't see any changes. I changed kinda half of the scripts I found with the find command, but I got the feeling that I'm doing something completely wrong.

Could someone enlighten me, if I've missed something or am doing something wrong? I think that this auto-generated file is the problem but I don't know from where it is getting generated to edit that file. Thanks for your time.

0

You've identified the correct php.ini file where you're configuration options are coming from. Its the file shown in the output of phpinfo(), which in your case is /var/www/vhosts/system/mysiteyo/etc/php.ini.

If you were to modify that file and restart Apache, then you should see your changes in the output of phpinfo().

The problem you have is the file is autogenerated, so any changes you make will not be persistent. The question you need to answer is, what is generating that file and how is it doing it? My guess would be that you have some form of control panel, such as cPanel or Plesk which is creating the /var/www/vhosts/system/mysiteyo/etc/php.ini file.

0

It is clear from the directory names that the system is managed by Plesk. Plesk manages all the different php.ini settings for each domain. It also has an inheritance model for php.ini configuration which may be specified at admin, tenant (user that can create more customers), subscription (dividing a share of customers resource allocation) and domain level, although to a greater extend domain is part of subscription.

Once you put a system in the hands of something like Plesk you have to let it do it's job exclusively, otherwise you'll enter a world of pain.

  1. Log in to Plesk
  2. Home -> Subscriptions -> example.com -> Website & domain -> example.com -> PHP Settings
  3. Scroll to the bottom and you can add any php.ini settings you like.
  4. Hit save

You can now see the changes in /var/www/vhosts/system/example.com/etc/php.ini. The best thing about getting Plesk to manage the configuration for you, is that Plesk manages it all for you! So if you upgrade PHP (using the Plesk software manager) it will change all the core PHP configuration then re-apply all your specific changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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