• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Where is the default php.ini?

don1

New Pleskian
I've tried to change date.timezone in /etc/php.ini but the default time zone stays the same as 'UTC'.
Where can I change the values in php.ini for every websites?
 
but the default time zone stays the same as 'UTC'.
Stays where? Please be more specific. And you can find needed php.ini with phpinfo() function at least.
 
Stays where? Please be more specific. And you can find needed php.ini with phpinfo() function at least.

I've edited the date.timezone in /etc/php.ini but this doesn't take effect to the existing domains that don't have date.timezone in their /var/www/vhosts/system/domain.ltd/etc/php.ini.

So I changed the date.timezone /var/www/vhosts/system/domain.ltd/etc/php.ini for a domain and now it's changed.
Does this mean all domains are not using /etc/php.ini? I've changed few settings in /etc/php.ini and this wasn't changed in the one of domains that doesn't have date.timezone.

All I want to know is how to change the server-wide settings for all domains and I know that changing the value in /etc/php.ini doesn't work.
 
Last edited:
Hi,

can anyone answer the above question from don1?

I would also like to know how to set a server-wide date.timezone for php so that I don't have to set it each time I set up a new domain in Plesk.

Thanks.
 
Hi,
it works in the following way:
1. during domain creation base php.ini for specified php handler is copied to domain's location.
You can get list of all registered php handlers and basic php.ini files using: /usr/local/psa/admin/sbin/php_handlers_control --list
php.ini for a particular domain is placed in: /var/www/vhosts/system/<domain_name>/etc/php.ini

2. php settings from service plan and subscription settings are applied to this per-domain php.ini
"Default" value in service plan means "keep the same value as base php.ini has".

So you can change settings via service plan or base php.ini file.

P.S. For "apache module" php settings are defined in apache configs instead of php.ini for each domain.
 
You can use a script like this to change the existing time zones in the php.ini's. Dont forget to change the default for that id. As dash sayd: you can use the --list command to find what php versions are installed and what id they have.

<?php

$hosts = "/var/www/vhosts/system";
$pwfile = "/etc/psa/.psa.shadow";

$pw = trim(file_get_contents($pwfile));

mysql_connect("localhost","admin", $pw);
mysql_select_db("psa");

if (!($result=mysql_query("select name from domains, hosting where domains.id = hosting.dom_id and hosting.php_handler_id = 'ID_YOU_WANT_TO_CHANGE';"))) {
print("MySQL error: " . mysql_error());
}

$aantal = mysql_num_rows($result);

for ($r = 0; $r < mysql_num_rows( $result); $r++) {
$row = mysql_fetch_array ($result);
$domain = $row[name];
// $domain = "YOURTESTDOMAIN.com";
if (is_file("$hosts/$domain/etc/php.ini")) {
echo ("\n\nfound: $hosts/$domain/etc/php.ini\n\n");
$lines = file ("$hosts/$domain/etc/php.ini");
$conf="";
$confbak="";
foreach ($lines as $line_num => $line) {
$conf = $conf . $line;
}
$hconfbak = fopen ("$hosts/$domain/etc/php.ini.bak", "w+");
fputs ($hconfbak, $conf);
$conf .= "\nadd this line\nanother line\na 3rth line\n";
echo $conf;
$hconf = fopen ("$hosts/$domain/etc/php.ini", "w+");
fputs ($hconf, $conf);

fclose($hconfbak);
fclose($hconf);
} else {
echo ("SOMETHING IS WRONG: $hosts/$domain/etc/php.ini\n");
}
}
?>

If you already have an entry and you want to change it, you need to replace

$conf .= "\nadd this line\nanother line\na 3rth line\n";
by
$conf=str_replace ("search for", "replace with", $conf);

disclaimer: this is an existing script we use to change vhost.conf file changed for php.ini on the fly. It is possible i missed something, you need to test is for yourself on a testdomain.

hope this helps

regards
Jan
 
Back
Top