• 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

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)

Same problem here. Any help from Parallels would be appreciated...
 
Does httpd need to be restarted for changes in these local php.ini's to be activated or is it only for php-cgi?

Correct path is /var/www/vhost/domain.tld/conf/php.ini

After a recent upgrade from Plesk 10.1 to 10.3.1 I found CGI-PHP sites have had /var/www/vhost/domain.tld/etc/php.ini created automatically. No signs of any /var/www/vhost/domain.tld/conf/php.ini or /var/www/vhosts/.skel/0/conf/php.ini files. Why not create them while it's at it if that is the "correct path".

Same problem here. Any help from Parallels would be appreciated...

Agree with the others, if we're meant to use conf/php.ini it would be nice to know how to activate it.
 
Last edited:
same here, how to set default php variables via template -> skel ? it does not work since plesk 10.3 ? new php.ini is located in /var/www/vhosts/domain/etc/php.ini -> so /var/www/vhosts/.skel/0/conf|etc/php.ini has no effect ??????? please help ?
 
Hi


- I have managed to disable open_basedir for new domains by adding lines to

/var/www/vhosts/.skel/0/conf/php.ini

-----------
PHP:
open_basedir =
-----------

- now all NEW domains have disabled open_basedir

How do I make existing domains disable open_basedir ????? And for the settings to stick ????

I have a post here (explaining my annoyances with Plesk 10.3)

http://forum.parallels.com/showthread.php?t=113236
 
can't change global php.ini

since 10.3 how can we update /etc/php.ini for all domain ?
 
since 10.3 how can we update /etc/php.ini for all domain ?

This script will overwrite all your %DOMAIN%/etc/php.ini files with the /root/php.ini file
Please note that this will (over)write even %VHOSTS%/chroot/etc/php.ini (and eventually %VHOSTS%/default/etc/php.ini) file(s). Maybe you'll have to do some backup.

#!/bin/bash
for file in *; do
if [ -d $file ]; then
cp /root/php.ini $file/etc/php.ini;
fi
done

1. Place the source php.ini file into /root/ dir
2. Place the script into the %VHOSTS% dir (eg: /var/www/vhosts/ )
3. Make sure your pwd is %VHOSTS% (if not, change dir)
4. Run the script (you'll probably get errors if a domain does not contain the etc dir)

Note: I've not tested this in a production environment. Take this script "as it is", no guarantee.
 
Please, how does this work in Windows Server 2008? It is the same folders to put the php overrides into?
 
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"[/QUOTE]

On our Plesk 10.3.1 we enabled [B]FastCGI [/B]mode on "example.com" domain, but it seems that Apache always uses "/etc/php.ini" [B]and ignores[/B] "/var/www/vhosts/example.com/conf/php.ini" ...

After creating "example.com" with the default "Apache module", "/var/www/vhosts/example.com/conf/" and "/var/www/vhosts/example.com/etc/" [B]was without "php.ini"[/B]

[B]After set FastCGI mode[/B] on example.com, only in "/var/www/vhosts/example.com/etc/" appeared the "php.ini" as is:

[PHP]
open_basedir = /var/www/vhosts/example.com/httpdocs:/tmp
safe_mode = Off

"/var/www/vhosts/example.com/conf/" remains without the php.ini (is it normal ?)

so i put in "/example.com/conf/" this php.ini and I restarted Apache (httpd)

[PHP]
safe_mode = Off
open_basedir = /var/www/vhosts/example.com/httpdocs:/tmp
session.save_path = /var/www/vhosts/example.com/httpdocs/session [B]( <-- IGNORED !! the session was created in the default-php folder "/tmp" )[/B]

It seems that Apache [B]IGNORES both "per domain php.ini"[/B] and it [B]looks only[/B] to the general default "/etc/php.ini" ...

Why so ? Something missing ?

Thank you.

I.
 
nothing ?

up for me...

Loaded Configuration File --> /etc/php.ini

always the same... it should be --> /var/www/vhosts/example.com/etc or conf/ ... right ?
 
"/var/www/vhosts/example.com/conf/" remains without the php.ini (is it normal ?)
Yes, it is normal. Create it when you need custom content.

so i put in "/example.com/conf/" this php.ini and I restarted Apache (httpd)

PHP:
safe_mode = Off
open_basedir = /var/www/vhosts/example.com/httpdocs:/tmp
session.save_path = /var/www/vhosts/example.com/httpdocs/session ( <-- IGNORED !! the session was created in the default-php folder "/tmp" )

It seems that Apache IGNORES both "per domain php.ini" and it looks only to the general default "/etc/php.ini" ...
[/QUOTE]

Enable safe_mode on your site, then disable it again. Check content of etc/php.ini. It shall include session.save_path from from conf/php.ini and your session shall be stored in that folder. Once again - Apache reads etc/php.ini only, conf/php.ini is only a place for your custom instructions.

It is not very convenient now, but next version will let editing all settings in UI.

Regards
 
Yes, it is normal. Create it when you need custom content.



Enable safe_mode on your site, then disable it again. Check content of etc/php.ini. It shall include session.save_path from from conf/php.ini and your session shall be stored in that folder. Once again - Apache reads etc/php.ini only, conf/php.ini is only a place for your custom instructions.

It is not very convenient now, but next version will let editing all settings in UI.

Regards

Thank you Sergey, i did it step by step :

/var/www/vhosts/example.com/etc
PHP:
session.save_path = /var/www/vhosts/example.com/httpdocs/session
safe_mode = Off
open_basedir = /var/www/vhosts/example.com/httpdocs:/tmp

/var/www/vhosts/example.com/conf
[PHP]
session.save_path = /var/www/vhosts/example.com/httpdocs/session

restarted apache but i see (test session):

A "session.save_path" is currently not set. [B]( ---> in /etc/php.ini is not set in fact, so it use default /tmp...)[/B]
Normally "/tmp" or "C:\tmp" (or whatever the OS default "TMP" folder is set to) is used in this case.

moreover phpinfo:

Server API: 	CGI/FastCGI 
Virtual Directory Support: 	disabled 
Configuration File (php.ini) Path: 	/etc 
Loaded Configuration File: 	/etc/php.ini

[B]Again [/B]session.save_path = /var/www/vhosts/example.com/httpdocs/session in /var/www/vhosts/example.com/etc/php.ini seems to be [B]ignored[/B]...

what am I missing this time ?

Thank you!
 
Last edited:
Any news about ?

maybe is a problem with cgi_wrapper ???

My cgi_wrapper is default, have i to edit something ?

HELP !

Thank you.
 
Hi, that's very strange - for some reason session.save_path wasn't read by PHP. I cannot assist with that remotely, you will need Support Service assistance for that. If you purchased Plesk recently and from Parallels directly, you probably yet have free support service - please check it on http://www.parallels.com/support/
 
Hello, you may be interested in evaluating recent 10.4 preview as it introduces much easier way to configure PHP for your sites. PHP Settings are managed from UI and work for both FastCGI and mod_php modes. Current custom settings in conf/php.ini should be preserved (but not imported).

Regards
 
Answer: Give up!?

I gave up with this method as it might work when you create a site, but to make changes it just ignores them whether you put them in etc or conf. I've tried re-configuring the sites at shell, I've tried enabling safe mode via panel and then taking it off again; it just ignore custom settings for some reason.

The method I found best is to use conf/vhost.conf and include php settings inside there...
<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_flag register_globals on
</Directory>

This method ONLY WORKS IF - using PHP as Apache Module, but the benefit is that you can simply modify the conf/vhost.conf for one site and apply it by restarting httpd.
 
Last edited:
You probably will be interested in upcoming 10.4, which has editing of PHP settings in UI:
- works for FastCGI/CGI/mod_php
- no tricks needed to re-apply configuration
- template are easily defined in Service Plans
 
Plesk and CBM are bundled. So when you install PLesk 10.4, it will bring CBM 10.4. Of course, production upgrade shall not be performed until it is released in public.

Regards
 
Back
Top