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.

oscommerce and php safe mode

Discussion in 'General Discussion' started by Radio_Head, Mar 26, 2003.

  1. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    I am running php safe mode from several weeks now , without any big problem .

    But I found now that oscommerce generate an error using php safe mode ...


    Warning: is_dir() [function.is-dir]: SAFE MODE Restriction in effect. The script whose uid is 32003 is not allowed to access /tmp owned by uid 0 in /home/test/public_html/oscommerce/includes/header.php on line 30


    Any idea to avoid this error ?
     
  2. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    Ok I solved ..

    when cpanel execute the oscommerce installation tag I execute this php line ..

    <?
    shell_exec("replace \"define('STORE_SESSIONS', '')\" \"define('STORE_SESSIONS', 'mysql')\" -- /home/$auserb/public_html/$url/includes/configure.php");
    ?>


    In this way oscommerce works fine with php safe mode saving
    the session on mysql .
     
  3. mrbill

    mrbill Member

    Joined:
    Oct 23, 2002
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    you can also define the session in the OSC configure.php file.

    Look in /includes/configure.php

    last line asks where you want to store sessions. Just insert 'mysql' in between the qoutes.


    This will have to be done for both the store frontend and the admin area.
     
  4. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    yes , infact my php lines above make exactly that ;) They assign
    mysql on configure.php .
     
  5. LinuxFreaky

    LinuxFreaky Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    6
    Why not just modify the configure.php in the osCommerce tar package:
    /usr/local/cpanel/addons/osCommerce/pkg.tar.gz

    Will cpanel updates overwrite this?

    Also, are there other bad consequences of turning on safe mode for users?
     
  6. LinuxFreaky

    LinuxFreaky Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    87
    Likes Received:
    0
    Trophy Points:
    6
    I modified the osCommerce package file located in /usr/local/cpanel/addons/osCommerce/pkg.tar.gz so that the configure.php file in there uses mysql to store sessions. However I noticed that it's always reverting back. This tells me Cpanel updates are overwriting it.

    I can do a chattr but then if there are critical updates I might miss them. How are you guys doing the php replace script upon user install of osC? Modify the cpanel html files?

    cPanel.net Support Ticket Number:
     
  7. cass

    cass Well-Known Member

    Joined:
    Jul 17, 2002
    Messages:
    354
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Argentina/USA/Mexico
    Anyone submitted a ticket on this ?

    maybe it's just more simple to tell DarkOrb to put 'mysql' as default ...

    I think most of us use safe mode ... you know what that evil php shell script does ... heh :D

    Regards.

    cPanel.net Support Ticket Number:
     
  8. NiN

    NiN Active Member

    Joined:
    Apr 30, 2003
    Messages:
    29
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Braga, Portugal
    Replace the package???

    Why do you do things the hard way? Just do this:
    Uncoment the second line in each (remove '#'):

    #do we need this?
    #regsrep("$installdir/includes/configure.php","\\(\'STORE_SESSIONS\'","define('STORE_SESSIONS', 'mysql');");


    #do we need this?
    #regsrep("$installdir/admin/includes/configure.php","\(\'STORE_SESSIONS\'","define('STORE_SESSIONS', 'mysql');");


    in the file:
    /usr/local/cpanel/addons/osCommerce/install

    Regards,
    ~ Dani
     
    #8 NiN, Jun 4, 2003
    Last edited: Jun 4, 2003
  9. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    oscommerce recently started again to show safe mode on errors ..

    as it seems storing session on mysql is no more enough (!)

    Anyone found a turnaround ?
     
  10. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Did you find a solution? I'm getting safe mode errors even though sessions are set to use mysql.
     
  11. Radio_Head

    Radio_Head Well-Known Member

    Joined:
    Feb 15, 2002
    Messages:
    2,051
    Likes Received:
    1
    Trophy Points:
    38
    Open
    /home/user/public_html/catalog/include

    change
    define('STORE_SESSIONS', '');
    with
    define('STORE_SESSIONS', 'mysql');

    Open
    /home/user/public_html/catalog/includes/functions/sessions.php

    change

    function tep_session_save_path($path = '') {
    if (!empty($path)) {
    return session_save_path($path);
    } else {
    return session_save_path();
    }
    }


    with

    function tep_session_save_path($path = '') {
    if (!empty($path)) {
    return @session_save_path($path);
    } else {
    return @session_save_path();
    }
    }


    open
    /home/user/public_html/catalog/admin/includes/functions/sessions.php

    change

    function tep_session_save_path($path = '') {
    if ($path != '') {
    return session_save_path($path);
    } else {
    return session_save_path();
    }
    }

    with

    function tep_session_save_path($path = '') {
    if ($path != '') {
    return @session_save_path($path);
    } else {
    return @session_save_path();
    }
    }






    I am using these changes without any problem from 1 sept .( I am using
    a customized php cpanel skin , and I aplly these change automatically using the
    php shell exec command )-
     
    #11 Radio_Head, Sep 24, 2005
    Last edited: Sep 24, 2005
  12. rs-freddo

    rs-freddo Well-Known Member

    Joined:
    May 13, 2003
    Messages:
    832
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Australia
    cPanel Access Level:
    Root Administrator
    Thank you very much - that works fine!
     
  13. Ferdinant

    Ferdinant Active Member
    PartnerNOC

    Joined:
    Mar 1, 2005
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    solution

    We use the following solution:

    1. Login into WebHost Manager
    2. Go to phpMyAdmin
    3. Find the corresponding database
    4. Browse the 'configuration' table.
    5. Change the record WHERE configuration_key says "SESSION_WRITE_DIRECTORY" and change the configuration_value to /home/username/tmp

    ofcourse username should be replaced with the correct username.

    This is a bugfix for the session_save_path problem and also makes the osCommerce installation more secure.
     
Loading...

Share This Page