The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Sessions Problem

Discussion in 'General Discussion' started by Dweezel, Jan 14, 2008.

  1. Dweezel

    Dweezel Member

    Joined:
    Sep 26, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I'm having problems with PHP sessions on our miniserver. We have two sites on the server and are about to move a third there as well. This third site makes use of PHP sessions and about a month ago I moved the whole site onto our miniserver and it worked perfectly. However, we've recently done a rebuild of apache/PHP and now sessions aren't working. I've tested PHP sessions on all 3 sites and none of them are working.

    I had some advice from a friend that I should check where session.save.path is pointed to and ensure that that file is writable. In WHM the session.save.path field is set to "N;/path **DEFAULT**, Click to Edit", and it says that the default is /tmp so I'm guessing that it's set to that. Now does that mean the tmp file which is in each site's home directory? (the same level as the public_html). If it does then changing the permissions on this file from 755 which it was set to, to 777 has no effect on the sessions problem. I'm guessing the problem is with the PHP configuration somewhere.

    Here's the session settings in my PHP configuration editor. Sorry about the formatting

    Code:
    session.auto_start  	 	    0
    session.bug_compat_42 	       1
    session.bug_compat_warn       1	
    session.cache_expire 	          180
    session.cache_limiter 	           nocache
    session.cookie_domain 		
    session.cookie_lifetime           0
    session.cookie_path 	          /
    session.entropy_file 		
    session.entropy_length 	         0
    session.gc_divisor 		    100
    session.gc_maxlifetime 	        1440
    session.gc_probability 	          1
    session.name 		           PHPSESSID
    session.referer_check 	         0
    session.save_handler 	         files
    session.save_path                 (Defaults to /tmp.)	N;/path **DEFAULT**, Click to Edit
    session.serialize_handler        PHP	
    session.use_cookies 	          1
    session.use_only_cookies        1 **DEFAULT**, Click to Edit (NOTE:the 1 has a strike through it)
    session.use_trans_sid 	          0
    url_rewriter.tags 	               a=href,area=href,frame=src,input=src,form=,fieldset=
    

    I'm using PHP 4.4.7 running on apache. This is the error I'm getting when trying to pass PHP sessions between pages:




    Any help appreciated,

    TIA,

    Chris.
     
  2. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    This is referring to your system /tmp directory and not the user dir's. Be sure its permissions are set to 1777

    As for the NOTICE, this is a notice not an error. You probably have register_globals off which is a good thing. Just adjust your error reporting so you don't see it.
     
  3. Dweezel

    Dweezel Member

    Joined:
    Sep 26, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the reply Jayh38. I should have said in my original post that I've got error reporting set to 'ALL' in my PHP script in order to debug this sessions problem.

    How would I go about changing the file permissions for the system /tmp folder. The friend who advised me previously on this problem has said that I'll need an SSH client, is this correct? I'm sorry if these are elementary questions but this is all new to me. I had a search on download.com and found a client called Putty Portable. I've installed it and have logged into the the root of our miniserver. If this is the right way to go could you give me any tips on how to check and change the file permissions on /tmp?

    Thanks,

    Chris.

    [edit]
    I've tried chmod 1777 tmp and chmod 1777 /tmp. That either hasn't worked or hasn't solved the problem. Any advice on what to type into my command line client would be greatly appreciated. Thanks.


    I also used 'ls -l' to output file permissions and got the following (no mention of /tmp in this list):

    drwxr-x--- 15 root root 4096 Jan 14 02:16 ./
    drwxr-xr-x 22 root root 4096 Nov 26 14:48 ../
    drwx------ 8 root root 4096 Apr 5 2007 .MirrorSearch/
    -rw------- 1 root root 13924 Dec 4 13:08 .bash_history
    -rw-r--r-- 1 root root 24 Dec 3 2004 .bash_logout
    -rw-r--r-- 1 root root 191 Dec 3 2004 .bash_profile
    -rw-r--r-- 1 root root 176 Dec 3 2004 .bashrc
    drwxr-xr-x 3 root root 4096 Jun 7 2007 .cpanel/
    drwx------ 2 root root 4096 May 17 2007 .cpanel-datastore/
    drwx------ 3 root root 4096 Jan 16 2006 .cpmysqlrpm/
    drwx------ 4 root root 4096 Oct 27 11:38 .cpobjcache/
    -rw-r--r-- 1 root root 100 Dec 3 2004 .cshrc
    drwxr-xr-x 3 root root 4096 Feb 12 2004 .emacs.d/
    drwx------ 2 root root 4096 Apr 14 2007 .gnupg/
    -rw------- 1 root root 60 Dec 4 12:22 .lesshst
    -rw------- 1 root root 1024 Nov 20 14:03 .rnd
    drwx------ 2 root root 4096 Jan 16 2006 .spamassassin/
    drwx------ 2 root root 4096 Nov 20 14:29 .ssh/
    -rw-r--r-- 1 root root 129 Dec 3 2004 .tcshrc
    -rw------- 1 root root 5418 Jul 28 2005 .viminfo
    -rw-r--r-- 1 root root 1 May 22 2007 .whmtheme
    drwxr-xr-x 4 root root 4096 Jan 16 2006 cpanel3-skel/
    drwxr-xr-x 4 500 mailtrap 4096 Nov 26 11:57 perl588installer/
    -rw-r--r-- 1 root root 4279 Nov 20 23:14 perl588installer.tar.gz
    drwxr-xr-x 2 root root 4096 Jan 16 2006 public_ftp/
    drwxr-xr-x 3 root root 4096 Jan 16 2006 public_html/

    It's also odd that public_html and such is listed above. Are these contents of a home directory of one of the sites on the server?

    Any help appreciated.
    [/edit]
     
    #3 Dweezel, Jan 14, 2008
    Last edited: Jan 14, 2008
  4. jayh38

    jayh38 Well-Known Member

    Joined:
    Mar 3, 2006
    Messages:
    1,215
    Likes Received:
    0
    Trophy Points:
    36
    Ouch, looks like you got some files jumbled around. You appear to have listed the /root dir but also seem to have some /home dirs in there as well. You would need to list the root of the system and not the root user dir.
    cd /
    will bring you to the system top level dir and your /tmp should appear and or /var/tmp

    I don't think its a good idea for you to pursue things further on your own and suggest asking your data center for help or possibly higher an administrator to look over your server.

    Best to you...
    jay
     
Loading...

Share This Page