1

I am having this PHP script that fails to save the session variable when I hit submit in my PHP Version 5.1.6 linux centos system. This problem happens over time. Currently I temporary solve this problem with PHP by rebooting the machine. However, this is not a good solution. It is just a temporary solution.

Here is PHP Session info:

Directive   Local Value Master Value 
session.auto_start  Off Off
session.bug_compat_42   Off Off 
session.bug_compat_warn On  On
session.cache_expire    180 180 
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value 
session.cookie_lifetime 0   0
session.cookie_path /   / 
session.save_path   /var/lib/php/session    /var/lib/php/session
session.serialize_handler   php php 
session.use_cookies On  On
session.use_only_cookies    Off Off 
session.use_trans_sid   0   0

Under PHP core:

Directive   Local Value Master Value
open_basedir    /var/www/domain.com/httpdocs/public_html/:/tmp/ no value

I would like anyone to suggest why rebooting the machine solves the temporary PHP session variables not saved.

My PHP code uses session variable to check if the captcha values are solved properly when I hit submit button. This check shown below is done when the page reloads after submit is hit.

<?php
session_start();

if($_SESSION['captcha_keystring'] == $_POST["keystring"]){


} // End: if capcha verification


else
{
        echo "Wrong Capcha Entered!";
}

?>

Even when this is captcha_keystring is solved properly this fails.

user914425
  • 16,303
  • 4
  • 30
  • 41
  • 2
    `/tmp` dir full? (which will be cleared on reboot...) Where does your server store the session files? – Wrikken Jan 13 '12 at 00:25
  • I belive session path is saved according to phpinfo() here session.save_path /var/lib/php/session. – user914425 Jan 13 '12 at 00:41
  • OK, I doubt that will be cleaned up on reboot (do check it though). If it fails, do all sessions fail to store new data, or just your captcha? Is there anything else in your error log? – Wrikken Jan 13 '12 at 00:56
  • Right now session is not working at all even after restart. Session variables return blank. What and where the error file are you referring too? – user914425 Jan 13 '12 at 17:52
  • First, check freespace on all disks with `df -h`. If that isn't the problem, the error log is probably that of apache, but it can be configured to be almost anywhere. In Debian/Ubuntu, I think the default location would be `/var/log/apache2/error_log`, but it may be elsewhere. Another option would be to temporarily set `display_errors` to `on`, letting the error show on you html pages. – Wrikken Jan 13 '12 at 17:56

0 Answers0