1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

10.3, php.ini Template

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by nevakee, Jul 9, 2011.

  1. nevakee

    nevakee Basic Pleskian

    19
    60%
    Joined:
    Dec 12, 2010
    Messages:
    61
    Likes Received:
    0
    Hi,

    where can I edit the php.ini template (/var/www/vhosts/<domain>/etc/php.ini)?

    best regards
    NevaKee
     
    Last edited: Jul 10, 2011
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    You can use it in 10.3 version like:
     
  3. nevakee

    nevakee Basic Pleskian

    19
    60%
    Joined:
    Dec 12, 2010
    Messages:
    61
    Likes Received:
    0
    I am looking for the template if a customer is created.
    It is nuisance to my default entries (disable_functions, memory_limit, etc...) for each customer to add later.
     
  4. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Try to use skeleton /var/www/vhosts/.skel/0/
     
  5. nevakee

    nevakee Basic Pleskian

    19
    60%
    Joined:
    Dec 12, 2010
    Messages:
    61
    Likes Received:
    0
    Simply create the folder /var/www/vhosts/.skel/0/etc/ with the php.ini file?

    open_basedir it changes automatically to the correct directory?
    (open_basedir = /var/www/vhosts/domain.tld/httpdocs:/tmp)
     
  6. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Not "etc" but /var/www/vhost/domain.tld/conf/php.ini - "conf/php.ini"
     
  7. nevakee

    nevakee Basic Pleskian

    19
    60%
    Joined:
    Dec 12, 2010
    Messages:
    61
    Likes Received:
    0
    Every customer has been using Plesk 10.3 a php.ini in the folder "etc" and also the cgi_wrapper (/usr/bin/php5-cgi -C /var/www/vhosts/domain.tld/etc/php.ini) why I wanted to be create a php.ini in the folder "conf"?
     
  8. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Correct path is /var/www/vhost/domain.tld/conf/php.ini
     
  9. nevakee

    nevakee Basic Pleskian

    19
    60%
    Joined:
    Dec 12, 2010
    Messages:
    61
    Likes Received:
    0
    What brings me the php.ini file if the file does not use the cgi_wrapper!

    /usr/bin/php5-cgi -C /var/www/vhosts/domain.tld/etc/php.ini
     
  10. Sergey L

    Sergey L Golden Pleskian Staff Member

    32
    43%
    Joined:
    Aug 10, 2006
    Messages:
    1,195
    Likes Received:
    30
    Hello nevakee,

    Let me explain how it works:
    1) you put a custom php.ini into /var/www/vhosts/.skel/0/conf/php.ini. Make sure it starts with "
    PHP:
    " just as normal php.ini file. That would be your template of php settings for CGI/FastCGI mode
    2) when new webspace/subscription is created in Plesk, it will take /var/www/vhosts/.skel/0/conf/php.ini and put it into  .../domain.tld/conf/php.ini. In this file you can safely tune settings of the specific vhost - Plesk won't overwrite them
    3) the instructions you put in .../domain.tld/conf/php.ini will be included in .../domain.tld/etc/php.ini file (which also includes open_basedir and safe_mode settings from the panel settings).

    So now you have desired content in .../domain.tld/etc/php.ini which is applied to your vhost if run in CGI/FastCGI mode. 

    Let me summarize:
    1) in .skel you have conf/php.ini which is a template for all your sites. If you put etc/php.ini in .skel - it won't wor, Plesk will overwrite the file.
    2) in domain.tld you have conf/php.ini which is your settings for the current vhost. Settings from this file are included into etc/php.ini and merged with other Plesk settings.

    Would it help you?

    NOTE: This php.ini is only for CGI/FastCGI. Another file and another customization approach is required for mod_php, details can be obtained from "
    Advanced Administration Guide"
     
  11. nevakee

    nevakee Basic Pleskian

    19
    60%
    Joined:
    Dec 12, 2010
    Messages:
    61
    Likes Received:
    0
    Thank you so much!
    That's what I meant. It works perfectly.

    Edit:
    Is there a possibility to generate the php.ini file later?
    Copy the php.ini in the "conf" folder and then create the php.ini file in "etc"?
     
    Last edited: Jul 12, 2011
  12. Kelos

    Kelos New Pleskian

    19
    80%
    Joined:
    Nov 11, 2009
    Messages:
    10
    Likes Received:
    0
    Hi,

    the solution worked fine for me... How do I create a php.ini for a subdomain? The php.ini from the skel folder has been copied to subdomains/domain/conf. When I check with phpinfo(), the php.ini is located /etc/php5/cgi/php.ini. The custom php.ini has not been read and the configuration in it was discarded. In the main domain, the php.ini is located in the etc folder inside the domaindirectory.

    Best Regards
    Markus
     
  13. Sergey L

    Sergey L Golden Pleskian Staff Member

    32
    43%
    Joined:
    Aug 10, 2006
    Messages:
    1,195
    Likes Received:
    30
    At this moment the solution works for domains only. We are refactoring subdomains for next version to eliminate such limitations coming from old versions.
     
  14. rosskendall

    rosskendall Basic Pleskian

    17
     
    Joined:
    Oct 13, 2010
    Messages:
    41
    Likes Received:
    0
    'variables' in skel?

    Thanks Sergey and Igor for this information, very helpful! (and very glad to have the feature)

    One further question: Is there a special string that can be used in the skel php.ini that will get translated into the domain name when a new domain is created.

    for example:
    /var/www/vhosts/.skel/0/conf/php.ini
    PHP:
    upload_tmp_dir = /var/www/vhosts/[B][domain][/B]/tmp

    changes to
    :
    [
    I]/var/www/vhosts/example.com/conf/php.ini[/I]
    [
    PHP]
    upload_tmp_dir = /var/www/vhosts/[B]example.com[/B]/tmp

    Thanks
    ,
    Ross.
     
  15. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
    Not sure that variables can be used in skel php.ini templates.
     
  16. rosskendall

    rosskendall Basic Pleskian

    17
     
    Joined:
    Oct 13, 2010
    Messages:
    41
    Likes Received:
    0
    Thanks for the quick reply :)

    Can I make that a feature request then?
     
  17. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,572
    Likes Received:
    1,243
    Location:
    Novosibirsk, Russia
  18. rosskendall

    rosskendall Basic Pleskian

    17
     
    Joined:
    Oct 13, 2010
    Messages:
    41
    Likes Received:
    0
    domain name substitution works!

    No need to submit a feature request, since the @domain_name@ variable works :)

    I tested the following:
    /var/www/vhosts/.skel/0/conf/php.ini
    PHP:
    upload_tmp_dir = /var/www/vhosts/[B]@domain_name@[/B]/tmp

    which did successfully convert to the following when creating a 
    new domain:
    [
    I]/var/www/vhosts/example.com/conf/php.ini[/I]
    [
    PHP]
    upload_tmp_dir = /var/www/vhosts/[B]example.com[/B]/tmp

    Thanks
    ,
    Ross.

    P.Sonly other thing to note is that I'm on openSUSE, so the actual path I'm using is /[B]srv[/B]/www/vhosts/
     
    Last edited: Jul 21, 2011
  19. rosskendall

    rosskendall Basic Pleskian

    17
     
    Joined:
    Oct 13, 2010
    Messages:
    41
    Likes Received:
    0
    One further question:

    How does one get etc/php.ini to update with changes made to conf/php.ini?

    (I tried /usr/local/psa/admin/bin/httpdmng --reconfigure-domain example.com but it didn't update)
     
  20. rosskendall

    rosskendall Basic Pleskian

    17
     
    Joined:
    Oct 13, 2010
    Messages:
    41
    Likes Received:
    0
    Any ideas about this? I ended up doing it manually :-/
     
Loading...