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.

How to modify PHP.ini? (register_globals problem)

Discussion in 'General Discussion' started by Bahrian, Aug 21, 2006.

  1. Bahrian

    Bahrian Registered

    Joined:
    Aug 21, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I installed oscommerce on a hosting account on my server (I do have access to WHM & Cpanel of that account). After complete installation, it gives following error when I open the oscommerce URL on that account:



    Can anybody help me in editing this PHP.ini file?

    I read on some website that you should write the following line: register_globals = On into a file and name it php.ini and upload it to public_html or the directory in which script is located. I tried this too, but it doesn't help.

    When I opened htaccess file, it has the following stuff written into it:

    Can anybody help me? How can I get rid of this register_globals problem?
     
  2. anka

    anka Member

    Joined:
    Mar 26, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    PHP.ini => Register_globals Problem

    Hi,

    you cann edit the httpd.conf file:

    /usr/local/apache/conf/httpd.conf:

    look for the Section Virtual-Host of the Domain and add the Bold line - save the File and restart Apache

    <VirtualHost your IP>
    ServerAlias www.domain.tld domain.tld
    ServerAdmin webmaster@domain.tld
    DocumentRoot /home/username/public_html
    BytesLog domlogs/domain.tld-bytes_log
    User username
    Group usergroup

    <IfModule mod_php4.c>
    php_admin_value register_globals 1
    </IfModule>

    <IfModule mod_php5.c>
    php_admin_value register_globals 1
    </IfModule>

    <IfModule mod_userdir.c>
    UserDir disabled
    UserDir enabled username
    </IfModule>
    ServerName www.domain.tld
    ScriptAlias /cgi-bin/ /home/username/public_html/cgi-bin/
    User reiki
    Group reiki
    CustomLog domlogs/domain.tld combined
    </VirtualHost>

    Regards

    G. Barbez
     
  3. cix

    cix Well-Known Member

    Joined:
    Nov 6, 2003
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    This works on php CGI(cpanel default) and phpsuexec enabled?
     
  4. anka

    anka Member

    Joined:
    Mar 26, 2004
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi

    its works on PHP as Module - I not Sure if et works on PHPCGI and phpsuexec.

    Regards

    G. Barbez
     
  5. hekri

    hekri Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    149
    Likes Received:
    2
    Trophy Points:
    18
    Maybe help someone:

    If you have php4 and php5 both as PDO and you want example enable register_globals with .htaccess put

    php5_flag register_globals On (Off)
    php4_flag register_globals On (Off)

    Normaly php_flag register_globals Off will work only for one version of PHP not for both.
     
  6. acenetryan

    acenetryan Well-Known Member
    PartnerNOC

    Joined:
    Aug 21, 2005
    Messages:
    197
    Likes Received:
    1
    Trophy Points:
    18
    If you're running PHP as an Apache module, you can set the php_flags as previously noted in this thread.

    If you're running PHP as CGI, you will need to remove the directives from your .htaccess or httpd.conf and instead place them within a php.ini file within the script's executing directory.

    If you have root access and want to make the change server-wide, you would edit the server's default php.ini.

    You would remove the php_flag directive and instead use only the variable you want to change. For example:

    Code:
    register_globals = On
    
     
  7. chae

    chae Well-Known Member

    Joined:
    Apr 19, 2003
    Messages:
    145
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Auckland, New Zealand
    We've just finished upgrading servers to Apache2.2, PHP5 & MySQL 5. Lots of sites on the servers were having the same RG problem. PHP was running with SuPHP & SuHosin.

    We got round the problem by creating the php.ini file & placing one in the public_html, catalog (whatever they named the oscommerce folder) and the admin folder. All sites started working no problem. You'll also find that the includes/configure.php will need it permissions changed & depending on which version of oscommerce you have or they have you'll need to tweak some of the code, not much but oscommerce's forum is well documented.

    Ideally if it's an older version you would upgrade to the latest & most secure
     
  8. kran

    kran Well-Known Member

    Joined:
    Jul 5, 2003
    Messages:
    74
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Colombia
    cPanel Access Level:
    Root Administrator
    This is what I do.

    I just create a php.ini with the following:

    register_globals = On
    allow_url_fopen = On
    safe_mode = Off

    Place it in the main oscommerce directory and chown it as the site user.
     
  9. hekri

    hekri Well-Known Member

    Joined:
    Oct 14, 2003
    Messages:
    149
    Likes Received:
    2
    Trophy Points:
    18
    I run php5 dso and php4 cgi. PHP4 cgi have register_globals set Off i put php.ini to public_html with register_globals = On and run phpinfo.php4 and still see register_globals Off - why?
     
  10. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
  11. ahlul_b4n9_s

    ahlul_b4n9_s Member

    Joined:
    Nov 28, 2006
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I have read it but i still get problem :( i have 3 server n i got same problem. my user can't modify php conf with their own php.ini.

    I tried all ways for compiling Apache+PHP4+PHP5 with Easy Apache but i still get wrong.

    And everything that sent by $_POST[] the PHP page can't display the value.

    Please some body help me. I had work for 1 week but i get nothing. :( Same problem again.


    I hope my user can modify their own php.ini
     
  12. acenetryan

    acenetryan Well-Known Member
    PartnerNOC

    Joined:
    Aug 21, 2005
    Messages:
    197
    Likes Received:
    1
    Trophy Points:
    18
    Ahlul,

    The easiest way to see whether the settings you are changing are actually taking effect is to create a phpinfo file within the same directory as the php.ini you are using to change settings. Simply create a file named 'phpinfo.php' and put this code in it:

    Code:
    <?php phpinfo(); ?>
    Then visit the page in a browser. You can search the page for the particular setting, say register_globals, and see if it is being set.
     
  13. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    The last time I tested this, one needed to use mod_suphp to get the behavior you want.
     
Loading...

Share This Page