• 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

Issue PHP Additional Directives do not apply to php cli

Dave W

Regular Pleskian
Server operating system version
AlmaLinux release 8.7
Plesk version and microupdate number
Plesk Obsidian 18.0.50.2
Greetz,

Set the date.timezone under Additional Directives in PHP settings.

PHP info page shows the correct setting of date.timezone

Log in as webspace user and
Code:
/opt/plesk/php/7.4/bin/php -i|grep timezone 
Default timezone => UTC
date.timezone => no value => no value

This causes issues when running crons as they will log incorrect timestamps.

Is there a way to manage this without having to set the date.timestamp via CLI in /opt/plesk/php/7.4/etc/php.ini

Rgds
D.
 
None of the PHP values on the PHP configuration page apply to CLI. The command line uses the php.ini file values.
 
But maybe when running something on the command line you can tell PHP to use a specific configuration file that you have designed for that job.
 
Try setting it in for webspace in :

websites & domains -> YourWebspace> PHP Settings
at the bottom you have "Additional directives":
1680248032859.png
Set time zone you need there .
date.timezone = Europe/
 
Nice try Butcher :)
Nope thats my point that doesnt work for crons/cli
But wasnt that a thing recently brought in by Plesk so that the php version used in PHP settings was also that used in cli? If so then shouldnt it use the settings as per Plesk PHP settings?
D.
 
this ISN"T working:
websites & domains -> YourWebspace> PHP Settings
at the bottom you have "Additional directives":

I can't change the domain PHP timezone date timestamp?
how to make it work?
 
FYI. i posted a BUG post, few minutes ago. My support said THAT is why the timezone change isn't working.

catch 22 :(
 
thanks but not working :(
PHP 8.0.28
FPM application served by nginx

Does PHP need to be restarted? Well, due to the bug/error with firewall/etc... can't be restarted.
 
I just came across this topic again and wanted to share a possible solution.

Plesk stores the domains custom PHP configuration in a file located at /var/www/vhosts/system/example.com/etc/php.ini. What you could do if need to run a PHP script via CLI (or a cron job) that needs the domains custom PHP configuration is to specify this file as the primary ini file with the -c flag. So for example:

Code:
/opt/plesk/php/8.2/bin/php -c /var/www/vhosts/system/example.com/etc/php.ini -i|grep timezone

Note that any PHP configuration directives from the default ini file (/opt/plesk/php/X.X/etc/php.ini) won't be used when loading a custom ini file. Also any PHP configuration directives configured in a file located in the /opt/plesk/php/8.2/etc/php.d directory take precedence. The -n flag can be used to stop loading any additional configuration files.

Hope this helps some one :)
 
Back
Top