• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.

PHP directives date.timezone & session.save_path are not set

Petrou Net

Basic Pleskian
Product: Parallels Plesk Panel Linux 10.3.1, version: psa v10.3.1_build1013110726.09 os_CentOS 5
Operating System: CentOS 5 i386. Kernel: 2.6.18-194.26.1.el5PAE
Architecture: i386
Please Note: Using PHP 5.3 (Packaged by Parallels) and PHP runs as FastCGI.


Problem Description:
It seems Plesk is now using a different php.ini file for each virtual host (Loaded Configuration File: /var/www/vhosts/xxxxx/etc/php.ini). However if you create a .php file and use phpinfo() (<?php phpinfo(); ?>) to check the configuration of PHP, you'll notice that some important directives are not configured, for example date.timezone & session.save_path are not set (Local Value: no value / Master Value: no value).
This causes errors on many php scripts.

Steps to reproduce:
1. Create a .php file and use phpinfo() (<?php phpinfo(); ?>) to check the configuration of PHP.
2. date.timezone & session.save_path have no value.


Actual Results:
Some important directives such as date.timezone & session.save_path (among others) have no value. This causes problems on many php scripts that need these directives correctly configured.
One way to temporary fix this, is to add an .ini file to /etc/php.d and set there the directives you want to be configured for all virtual hosts.

Expected Results:
Important PHP directives (such as date.timezone & session.save_path among others) should be configured correctly, to avoid any errors in php scripts.

Additional Information:
This issue started occurring when a server was upgraded to Plesk 10.3.0 and still continues on 10.3.1.
 
Thank you for detailed report. I have forwarded it to developers. I will update thread with results.
 
I had this same issue with my sites running under CGI/F-CGI. As Panel 10.3 promised, each site can have their own PHP configuration when running as (F)CGI. The config files can be found at

/var/www/vhosts/domain.tld/etc/php.ini

You have to be root to edit this file and add the date.timezone & session.save_path

When running the sites as an apache module, the sites pull the information from the /etc/php.ini file
 
Plesk does not manage these options. It behaves differently for module/cgi because the OS vendor setup PHP this way.

As a workaround, on CentOS create a .ini file in /etc/php.d/ and write there
session.save_path = /var/lib/php5

On Debian, there is a dedicated config /etc/php5/cgi/php.ini
 
I have the same problem in Plesk 10.3.0 when vhosts are configured as FastCGI module.

The workaround posted by IgorG isn't acceptable. All the values configured in the main php.ini file are lost.
date.timezone and session.save_path are only two of hundreds rules configured in the php.ini file. While these are the rules that generates visible errors on a php page, the missing of other values can seriously change the whole php behavior.

So my temporary solution is to delete all php.ini files in vhosts dirs, to force apache to read the main php.ini file stored in /etc/php.ini

For the vhosts I want to customize php.ini, I copy the main php.ini in its etc dir and then I change the values I need.

Another workaround solution can be copy the main php.ini in the modules dir that php scans for other ini files, but I think that these files are read after the php.ini, so you cannot redeclare any value set in the main file, 'cause it will be overwritten by the main file itself.
Eg. if I have a site that needs register_globals On and I add the rule in the custom php.ini file, then when php scans for other files and finds the main php.ini file, it finds the register_globals rule again, but this time is set to Off, so it overwrites my choice.

Instead, an allowable solution can be define a php.ini template that will be copied in each etc/ dir as a virtual host is created. I think it can be possible by now, indeed. Because I suppose this file is created by a script, so you could just change this script so that it reads a template file and write it in the new php.ini file along with new customized rules such as open_basedir.
Anyone knows if this is possible??

Do you know if after a syncronisation of the vhost with the service plan, the php.ini file is regenerated??
 
Last edited by a moderator:
Also, is there a way to define a custom php.ini file for subdomains?
In the vhost configuration file there isn't the directive for subdomain, but only for the main domain. So subdomains are forced to use the main php.ini (the one stored in /etc/php.ini).
Even in this case I need to modify the script that generates the vhost cofig file to include a PP_CUSTOM_PHP_INI directive for subdomains too. Possibly not the same of the main domain, but in a path like vhosts/domain.tld/subdomains/subdomain/etc/php.ini
 
disappointed

I have the same problem and I don't understand why I must edit the php.ini. Before using Plesk, I used SysCP a long time and I didn't have to edit anything manually. Now I'm using Plesk, which I have to pay, and there are so many problems I have to solve manually. Is this for real?

I guess Plesk has to patch this, not each user.
 
i have the same problem and i have edited my php.ini
iv checked phpinfo and im editing the correct file.

iv tried several different variations of date.timezone
date.timezone = Europe/London
date.timezone = "Europe/London"
date.timezone = (Europe/London)
date.timezone = ("Europe/London")
date.timezone = 'Europe/London'

none of these seem to work, its almost like php(installed by parallels panel) is ignoring the file...
is there any special file permissions the php.ini needs?
644,777,444,555 etc etc??
 
i have the same problem and i have edited my php.ini
iv checked phpinfo and im editing the correct file.

iv tried several different variations of date.timezone
date.timezone = Europe/London
date.timezone = "Europe/London"
date.timezone = (Europe/London)
date.timezone = ("Europe/London")
date.timezone = 'Europe/London'

none of these seem to work, its almost like php(installed by parallels panel) is ignoring the file...
is there any special file permissions the php.ini needs?
644,777,444,555 etc etc??
never mind, sorted it
using php -i|grep php.ini
it showed me there's an error on line 305...
opened in notepad++
line 305 showed (16mb)
which should have been a continuation from line 304...which is commented out..
removed this onto the line above, saved and closed, restarted httpd
working fine!
 
who made this problem?

sorry, but who creates this file? i guess plesk does.

so plesk has to fix it! i don't have the problem anymore, because we installed plesk on ubuntu, but plesk on debian had this problem and we spent a lot of time to solve that problem.
 
i dont know if its plesk thats created this file or when iv edited this file before i may have caused this error...but since so many ppl are having this problem......

not sure...but im working :D
 
Plesk 10.4.4 (Linux) date.timezone Setting

Hi Everyone,

I was getting this error in my error log for the website on dedicated IP(ONLY)

mod_fcgid: stderr: PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function.

further investigating the problem, i found out in phpinfo

Loaded Configuration File /var/www/vhosts/domain.com/etc/php.ini

ONLY for the websites on dedicated IP.

you can correct this by

Plesk 10 Panel > Domains > Open in Control Panel > Websites & Domains > under "domains" Select you domain > PHP settings > under "Additional directives"

date.timezone = "YourTimeZone"

timezones are available at http://php.net/manual/en/timezones.php

i was using 10.4.4 for awhile but this happened recently. maybe due to plesk 10 Autointaller update (NOT SURE)

Hope this can help someone facing the same problem. till Plesk fix it :)
 
Back
Top