• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

10.3, php.ini Template

nevakee

Basic Pleskian
Hi,

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

best regards
NevaKee
 
Last edited:
You can use it in 10.3 version like:
# cat /var/www/vhost/domain.tld/conf/php.ini
PHP:
max_execution_time = 600
max_input_time = 600
memory_limit = 128M[/QUOTE]

Keep in mind that it work when PHP is run over CGI or FastCGI
 
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.
 
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)
 
Not "etc" but /var/www/vhost/domain.tld/conf/php.ini - "conf/php.ini"
 
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"?
 
Correct path is /var/www/vhost/domain.tld/conf/php.ini
 
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
 
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"
 
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:
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
 
At this moment the solution works for domains only. We are refactoring subdomains for next version to eliminate such limitations coming from old versions.
 
'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.
 
Not sure that variables can be used in skel php.ini templates.
 
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.S. only 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:
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)
 
Back
Top