WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Fastcgi session problem plesk 9.2.2 and php 5.3.8 (7 posts)

  1. mark777
    Member
    Posted 2 years ago #

    I have had wordpress sites runniing beautifully - php 5.1.8 using fastcgi safe mode off on a linux installed with Plesk.

    As wordpress now requires me to update php - I did so. But now I cannot use php sessions. This is because when using fastcgi php runs with permissions of the domains FTP user. PHP configuration php.ini states default session path:

    ~# grep session.save_path /etc/php.ini
    session.save_path = "/var/lib/php/session"

    Default permissions for the directory is 770:

    ~# ls -ld /var/lib/php/session
    drwxrwx--- 2 root apache 65536 Dec 16 07:48 /var/lib/php/session
    ~#

    This states that only root/apache members are allowed to write in the sessions directory. This means that customer who run php in cgi cannot use sessions.

    The workaround for this was to change permissions for directory /var/lib/php/session to 777. That nolonger works when php is upgraded to 5.3.8. I just get a white screen with no errors in error.log

    I have tried everything I can think of to get sessions working… HELP!

  2. azunoman
    Member
    Posted 2 years ago #

    marak777..thanks for the post. I found you post and think I am having the same problem as circumstances are the same as mine.

    I was installing a magento system on my vds, plesk 9.3 and needed mcrypt on the sever. using putty and yum, I managed to installed it without much of a problem but apparently I yum also upgraded php to 5.3.8. This has not been a problem for my other non-wp sites.

    The one wordpress site I am running shows the fp fine. BUT any navigation via the menu or other links resulted in a white page. I have turned on error reporting and while some tipico php notices there is no hard error.

    I chmoded /php/sesssion to 777. This did not resolve the problem.
    Session file permissions after I did the chmod:

    # ls -ld
    drwxr-xr-x 3 root root 4096 Aug 26 07:27

    I opened a ticket to my server support group.

  3. mark777
    Member
    Posted 2 years ago #

    Hi Azunoman,

    Save the following in a page and call it something like testsession.php then upload it to your site. Then visit the page. Then refresh the page. If sessions are not working the number will stay at 1. If they are working it will increase by 1 each time i.e. 1,2,3 etc..

    <?php
    session_start();
    if(isset($_SESSION['views']))
    $_SESSION['views']=$_SESSION['views']+1;
    else
    $_SESSION['views']=1;
    echo "Views=". $_SESSION['views'];
    ?>

    This will allow you to test if the session is causing the problem. If it is make sure it has exactly the same permissions as /tmp/

    You mention you needed to install mcrypt, make sure you have amended the path to the Mcrypt module in /etc/php.ini

    Have you checked if mcrypt is installed correctly by using phpinfo()?

    Hope this helps

  4. azunoman
    Member
    Posted 2 years ago #

    Hi mark777, first, thanks for the FAST reply, you are a great asset!

    installed testession.php script and ran it. Here is the response:

    Warning: session_start() [function.session-start]: SAFE MODE Restriction in effect. The script whose uid is 10003 is not allowed to access /tmp owned by uid 0 in /var/www/vhosts/mywebsite.com.co/httpdocs/testsession.php on line 2
    
    Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: files (path: ) in /var/www/vhosts/mywebsite.com.co/httpdocs/testsession.php on line 2

    My current thinking is I did not do the chmod correctly, and am looking at the linux chmod command.
    here is session file info:

    ls -ld
    drwxr-xr-x 3 root root 4096 Aug 26 07:27
  5. mark777
    Member
    Posted 2 years ago #

    You need to check what permissions are set on /tmp/ and match them exactly in the session folder specified in your php.ini

    r.g. dwxr-xr-xt maybe. Also try chown to apache.

  6. azunoman
    Member
    Posted 2 years ago #

    Turned off safe mod and this fixed the problem!

  7. mark777
    Member
    Posted 2 years ago #

    Good stuff!

Topic Closed

This topic has been closed to new replies.

About this Topic