php.ini in /var/www/vhosts/system/domain.com/etc/

Discussion in 'Plesk Automation Suggestions and Feedback' started by Dave W, Nov 1, 2015.

  1. Dave W

    Dave W Kilo Poster

    Messages:
    67
    Hi folks,

    Can you tell me what generates /var/www/vhosts/system/domain.com/etc/php.ini where are these settings taken from?

    I ask because I have atomics panda php installed however when I switch to say php5.5-atomic I dont have a complete /var/www/vhosts/system/domain.com/etc/php.ini, it only contains the openbasedir.

    Is this because there isnt a default settings filet for /var/www/vhosts/system/domain.com/etc/php.ini for php5.5-atomic ?

    Would it be possible to use the default /var/www/vhosts/system/domain.com/etc/php.ini for php5.5-atomic?
    Obvoiusly deprecated functions would have to be watched for.

    Regards

    DaveW
     
  2. UFHH01

    UFHH01 Product Expert

    Messages:
    2,283
    Hi Dave W,

    please have a look at the PHP hierarchy, when you use Plesk:

    [​IMG]
    Because PHP settings inherit previous settings, you will only see setting - specific modifications at the (sub)domain - specific php.ini's, located at "/var/www/vhosts/system/(sub)domain.com/etc/php.ini".

    Please locate your php - version - depending ( complete ) php.ini's ( based on your php-handler settings for the (sub)domain !!! ) with the command:

    locate /php.ini

    Sure. If you add modifications to "/var/www/vhosts/system/domain.com/etc/php.ini", then these modification will be used, because it overwrites previous settings, as you can see in the above PHP hierarchy.

    It is still recommended to add modifcation over Plesk ( (sub)domain.com > Websites & Domains > PHP Settings ), to avoid issues/failures/problems and misconfigurations.
     
  3. Dave W

    Dave W Kilo Poster

    Messages:
    67
    Hi UFHH01, Thank you for your reply,

    I understand the hierarchy of the php settings, my issue is that when I select the base php install, php 5.3.3, I have a php ini file with many default settings in /var/www/vhosts/system/domain.com/etc/php.ini.

    If a client switches to one of the atomic php parsers say atomic-php5.4 then the /var/www/vhosts/system/domain.com/etc/php.ini only contains the openbasedir, no other settings.

    This is an issue because the php parser now throws a timezone warning even though the timezone is set in /opt/atomic/atomic-php54/root/etc/php.ini, which is read by php

    The timezone is also set in /etc/php.ini which is also read by php, so somewhere in the chain the timzone is being unset.

    So Im looking for a solution that will leave the base php.ini (/var/www/vhosts/system/domain.com/etc/php.ini) in place regardless of which php parser a client selects.

    Regards
    DaveW
     
  4. Dave W

    Dave W Kilo Poster

    Messages:
    67
    Hi UFHH01,

    Got to the bottom of it, the handlers were incorrectly added to the PPA management node.

    The php.ini path for the custom php.ini files was set as a path: /opt/atomic/atomic-php54/root/etc/
    Changing this to point at the particular ini file /opt/atomic/atomic-php54/root/etc/php.ini meant that the file /var/www/vhosts/system/domain.com/etc/php.ini was generated correctly using the defaults from /opt/atomic/atomic-php54/root/etc/php.ini.

    Regards
    DaveW
     
  5. SteveITS

    SteveITS Tera Poster

    Messages:
    277
    I had asked this question in http://forum.odin.com/threads/system-or-service-template-defaults-for-php.332684. We set up our handlers using "-phpini /usr/local/php5614-cgi/etc/php.ini" but it doesn't appear to actually be used? phpinfo() shows:

    Configuration File (php.ini) Path /usr/local/php5614-cgi/etc
    ...but...
    Loaded Configuration File /var/www/vhosts/system/example.com/etc/php.ini

    This is because PA runs the PHP FastCGI using a command line that specifies the php.ini file to use. I've not been able to figure out how to set a default timezone, other than compile in the "Scan this dir for additional .ini files" setting and force the same value for all sites, or else set it individually on each website inside the panel.
     
  6. Dave W

    Dave W Kilo Poster

    Messages:
    67
    Hi Steve,

    From your cp, what do you get for:

    /usr/local/psa/bin/php_handler --list -service-node <IP address of SN>
     
  7. SteveITS

    SteveITS Tera Poster

    Messages:
    277
    Dave, it varies a bit depending on versions of course but:

    id: display name: full version: version: type: cgi-bin: php.ini: custom:
    cgi 5.4.45 5.4.45 5.4 cgi /usr/bin/php-cgi /etc/php.ini false
    fastcgi 5.4.45 5.4.45 5.4 fastcgi /usr/bin/php-cgi /etc/php.ini false
    fastcgi5329ITS 5.3.29-ITS 5.3.29 5.3 fastcgi /usr/local/php5329-cgi/bin/php-cgi /usr/local/php5329-cgi/etc/php.ini true
    fastcgi5445ITS 5.4.45-ITS 5.4.45 5.4 fastcgi /usr/local/php5445-cgi/bin/php-cgi /usr/local/php5445-cgi/etc/php.ini true
    fastcgi5530ITS 5.5.30-ITS 5.5.30 5.5 fastcgi /usr/local/php5530-cgi/bin/php-cgi /usr/local/php5530-cgi/etc/php.ini true
    fastcgi5614ITS 5.6.14-ITS 5.6.14 5.6 fastcgi /usr/local/php5614-cgi/bin/php-cgi /usr/local/php5614-cgi/etc/php.ini true
    module 5.4.45 5.4.45 5.4 module /usr/bin/php-cgi /etc/php.ini false

    Sorry about the lack of columns, can't do much there. I'd followed http://kb.odin.com/en/123679, with a couple changes like adding "--with-mysql-sock" and "--with-mcrypt."
     
  8. Dave W

    Dave W Kilo Poster

    Messages:
    67
    Hi Steve, that all looks correct

    When you look at a phpinfo(); on domain.com you should see that the Configuration File Path is /usr/local/php5614-cgi/etc which is correct as this is the path to the php.ini for php5614-cgi.

    The acutal file being used though is file /var/www/vhosts/system/domain.com/etc/php.ini, which is an amalgamation of /usr/local/php5614-cgi/etc/php.ini and any settings you make as admin specifically for the domain via cp.

    So, if you set date.timezone to Europe/Paris in /usr/local/php5614-cgi/etc/php.ini, then date.timezone=Europe/Paris will be placed in /var/www/vhosts/system/domain.com/etc/php.ini.

    If via ppa cp you set date.timezone=Europe/Frankfurt for the specific domain.com under PHP Settings, then this will overide date.timezone=Europe/Paris and date.timezone=Europe/Frankfurt will be set in /var/www/vhosts/system/domain.com/etc/php.ini.

    Is this not happening for you?

    DaveW
     
  9. SteveITS

    SteveITS Tera Poster

    Messages:
    277
    Hi Dave, thanks for the explanation. Something like that is how I thought it should work, but I am pretty sure it wasn't working that way when we first started with PA back in March/April. Or, I could have done something wrong in the setup or PHP build. In any case I tried it again, and bingo, works just fine.

    So I can immediately see that it would be easier to use /usr/local/php56/etc/php.ini or /etc/php56/php.ini or similar and share the php.ini between 5.6.x versions. Plus keep "Scan this dir for additional .ini files" (/etc/php56.d in my other thread) so we can force a setting, like the MySQL socket location.

    The /usr/local/php5614-cgi/etc/php.ini file seems to be reread the next time the user saves their site's PHP configuration settings.
     
    Last edited: Nov 8, 2015
  10. Dave W

    Dave W Kilo Poster

    Messages:
    67
    Hi Steve,

    Great, Im not sure when the domains php.ini file is created, I do know its created when you change from one php version to another, Im not sure if its created when you reconfigure the domain. I'll poke about with it tomorrow and see.

    Just as a matter of interest, why different versions of php56 on offer, we just offer 5.3, 5.4, 5.5, 5.6 and just update them to the minor releases via the atomic repo.

    Dave
     
  11. SteveITS

    SteveITS Tera Poster

    Messages:
    277
    I edited out my question...saving the PHP config regenerates the domain's php.ini file. I'm guessing it's not read at other times.

    We have been building our own PHP releases every so often rather than use a repo. Odin's instructions were that way, and it lets us modify the build. I guess I'd have to see what Atomic's includes. I guess I didn't really think about it but will a "make install" install 5.6.14 over top of 5.6.13? That would be a bit easier. PA has a command parameter to replace PHP handlers on sites but contrary to the help/info, it doesn't take a "service node" IP parameter and tries to replace on all nodes. Fortunately it seems to check itself and if a "from" or "to" version is missing, skips that website.
     

Share This Page