1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

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

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by Petrou Net, Aug 4, 2011.

  1. Petrou Net

    Petrou Net Basic Pleskian

    23
    90%
    Joined:
    Jan 8, 2008
    Messages:
    58
    Likes Received:
    0
    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.
     
  2. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,576
    Likes Received:
    1,244
    Location:
    Novosibirsk, Russia
    Thank you for detailed report. I have forwarded it to developers. I will update thread with results.
     
  3. CJZ

    CJZ Basic Pleskian

    14
    85%
    Joined:
    Apr 27, 2011
    Messages:
    38
    Likes Received:
    0
    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
     
  4. IgorG

    IgorG Forums Analyst Staff Member

    49
    24%
    Joined:
    Oct 27, 2009
    Messages:
    24,576
    Likes Received:
    1,244
    Location:
    Novosibirsk, Russia
    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
     
  5. DiceWebSviluppo

    DiceWebSviluppo Guest

    0
     
    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: Sep 17, 2011
  6. DiceWebSviluppo

    DiceWebSviluppo Guest

    0
     
    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
     
  7. PhilippN

    PhilippN New Pleskian

    13
    35%
    Joined:
    Jun 14, 2011
    Messages:
    22
    Likes Received:
    0
    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.
     
  8. spid3r1987

    spid3r1987 Guest

    0
     
    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??
     
  9. spid3r1987

    spid3r1987 Guest

    0
     
    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!
     
  10. PhilippN

    PhilippN New Pleskian

    13
    35%
    Joined:
    Jun 14, 2011
    Messages:
    22
    Likes Received:
    0
    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.
     
  11. spid3r1987

    spid3r1987 Guest

    0
     
    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
     
  12. PriyanA

    PriyanA Regular Pleskian

    17
    35%
    Joined:
    Apr 25, 2012
    Messages:
    178
    Likes Received:
    9
    Location:
    Melbourne, Australia
    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 :)
     
Loading...