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 session.save_path, is there a way to set this globally to use what ever the user account is writ

Discussion in 'General Discussion' started by golden_eyes, Nov 22, 2014.

  1. golden_eyes

    golden_eyes Well-Known Member

    Joined:
    Aug 9, 2010
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    I know how to set the session.save_path in the php.ini manually to the current user. But is there a way to write it so it detects the current user?

    let us say we have 100 accounts on the server, they cant just all save sessions to /tmp, so they need to be saved on a per user account directory basis (something like /tmp/USERNAME or /home/USERNAME/tmp) However; currently I would need to manually type this into the php ini. Is there a way I can write the file once, or change some server config so that it just puts the user account name in automatically.

    So maybe on the server or in the php.ini file it would say something like:
    session.save_path = "/home/${USERNAME}/tmp"

    Is there a way to do this? Or a way to make the server generate the settings per account for me?

    Thanks in advance...
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    672
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Re: PHP session.save_path, is there a way to set this globally to use what ever the user account is

    Hello :)

    You could place an individual php.ini file within each account if you are using a handler that supports it (e.g. suPHP). You could develop a script that automatically updates that path for each php.ini file that's copied to the account's home directory.

    Thank you.
     
  3. golden_eyes

    golden_eyes Well-Known Member

    Joined:
    Aug 9, 2010
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    6
    Re: PHP session.save_path, is there a way to set this globally to use what ever the user account is

    Thank you for reply.

    In this case I'm allowing the users to update the php.ini and enabling some functions that are disabled globally, the safe_mode is too critical, when I disable it from the global php.ini, the user can enable it from his php.ini.

    Is there another idea could cover my needed?

    Please note that the purpose of this request is when I run the /scripts/securetmp it apply permission that couldn't be used by the php script as you see the error below:
     
  4. Misiek

    Misiek Well-Known Member

    Joined:
    Feb 23, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Re: PHP session.save_path, is there a way to set this globally to use what ever the user account is

    That's basically something wrong but not with secure tmp that should not affect writing session files to tmp. Do You use suPHP
     
  5. golden_eyes

    golden_eyes Well-Known Member

    Joined:
    Aug 9, 2010
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    6
    Re: PHP session.save_path, is there a way to set this globally to use what ever the user account is

    Yep, I'm using the suPHP and gettting the error
     
  6. Misiek

    Misiek Well-Known Member

    Joined:
    Feb 23, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    6
    Re: PHP session.save_path, is there a way to set this globally to use what ever the user account is

    Basically You can place in each public_html in .htaccess line
    suPHP_ConfigPath /home/user/
    Then place in this folder each time You crate an account php.ini file, then You will have custom php.ini on each account.
    Second way You can just set session.save_path to folder like /home/sessions/ and on this folder give permission 777 then in php.ini add to disable_functions = phpinfo, and thats it.
     
  7. sailendra

    sailendra Registered

    Joined:
    Nov 25, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Re: PHP session.save_path, is there a way to set this globally to use what ever the user account is

    No the above code doesn't use because this gives error
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    672
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Re: PHP session.save_path, is there a way to set this globally to use what ever the user account is

    Could you elaborate on the specific error message you are receiving? Do you have root access to this system?

    Thank you.
     
Loading...

Share This Page