SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing settings in php.ini and share host

    Hello,
    I would like to know if I use share host for my website, does the webhosting company allow me to change settings of directives in php.ini?

    Thank you in advance,
    John

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You will not be able to edit php.ini directly from your virtual (shared) server account. However, your web host can allow certain settings that are in php.ini to be overriden by your own custom settings that you can place in a .htaccess file either in the root directory of your site or a sub-directory of your site. So if you want to use a certain php initialisation setting you can check with your host to see if they allow you to set it from within .htaccess.

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    99.9% of hosts will not let you change anything in the php config file.

    You can change certain aspects using a .htacces (*.Nix) file. This changes will only be in your "part" of the server.

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you got super-fast fingers freakysid?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for fast reply,
    The reason is if I store session data in database, I need to set:
    session.save_handler = user ;

    I hope that they let me use .htacess to do that for my site.

    John
    Last edited by johnn; Jul 26, 2001 at 12:17.

  6. #6
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [snap!]

    We seem to play this game often seanf

  7. #7
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freakysid
    You will not be able to edit php.ini directly from your virtual (shared) server account. However, your web host can allow certain settings that are in php.ini to be overriden by your own custom settings that you can place in a .htaccess file either in the root directory of your site or a sub-directory of your site. So if you want to use a certain php initialisation setting you can check with your host to see if they allow you to set it from within .htaccess.
    do you know if there's a way that they can allow some but not others to be overridden in .htaccess? i know you can't set different admin things from .htaccess, but i mean the harmless things (like magic_quotes and stuff).

    in other words can you change ALL you can from .htaccess if you can change ANY? cuz, as far as i know, AllowOverride Options is what enables things to be changed and i don't see any way that the host could say "this value can be changed but this one can't."
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    johnn those session settings can be changed right in your script. For instance here is how ichange my sessions to use a database for storing data.

    PHP Code:
    $sess_lifetime get_cfg_var("session.gc_maxlifetime");

    function 
    sess_open() {
        global 
    $db;
        return 
    $db;
        }

    function 
    sess_close() {
        return 
    true;
        }

    function 
    sess_read($key) {
        global 
    $db;
        
    $db->query(sprintf("SELECT value FROM sessions WHERE sesskey = '%s' AND expire > %s"$keytime()));
        if (
    $db->num_rows() > 0) {
            
    $db->next_record();
            return 
    $db->f(value);
            }
        else {
            return 
    false;
            }
        }

    function 
    sess_write($key,$val) {
        global 
    $db$sess_lifetime;
        
    $expire time() + $sess_lifetime;
        
    $value addslashes($val);
        
    $db->query(sprintf("UPDATE sessions SET expire = %s, value = '%s' WHERE sesskey = '%s' AND expire > %s"$expire$value$keytime()));
        if (
    $db->affected_rows() < 1) {
            
    $db->query(sprintf("INSERT into sessions SET sesskey = '%s', expire = %s, value = '%s'"$key$expire$value));
            }
        return 
    $db->affected_rows();
        }

    function 
    sess_destroy($key) {
        global 
    $db;
        
    $db->query(sprintf("DELETE from sessions WHERE sesskey = '%s'"$key));
        return 
    $db->affected_rows();
        }

    function 
    sess_gc() {
        global 
    $db$sess;
        
    $db->query(sprintf("DELETE from sessions WHERE expire < '%s'"time()));
        return 
    $db->affected_rows();
        }



    session_set_save_handler(
        
    "sess_open",
        
    "sess_close",
        
    "sess_read",
        
    "sess_write",
        
    "sess_destroy",
        
    "sess_gc"); 

    As you can see I use session_set_save_handler() to tell php how to use sessions. As long as you have the functions you can simply change it this way.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by DR_LaRRY_PEpPeR


    do you know if there's a way that they can allow some but not others to be overridden in .htaccess? i know you can't set different admin things from .htaccess, but i mean the harmless things (like magic_quotes and stuff).

    in other words can you change ALL you can from .htaccess if you can change ANY? cuz, as far as i know, AllowOverride Options is what enables things to be changed and i don't see any way that the host could say "this value can be changed but this one can't."
    Nah - I don't know - I'm talking through my **** like usual. You are probably right. Its these sort of technical details that my head can never retain for longer than 10 minutes, and I am always going to the manual or searching in google to find the answers to

  10. #10
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Freddydoesphp,
    I read an session tracking article at onlamp.com that says I need to set:
    session.save_handler = user ;

    before I use the codes similar to yours, but you said there's no need for this setting. I'm really confused, but well, I'll try without it to see if it works

    Thanks,
    John

  11. #11
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I looked over the article, indeed it does say to change that setting in the php.ini file. I have never made that change and my sessions get stored in the database, so that leads me to believe that step is not necessary. You may want to just test out some different combinations, I would start with just the functions and the session_set_save_handler().
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •