Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Aug 2009
    Posts
    8

    Default .htaccess php_flag command fail

    Hi ,

    I try to change global_register flag defaulted "off" on my web site by adding a statement "php_flag register_globals on " in .htaccess file, but the error "Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. " has shown on my web site, and also i found " .htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration " in error log file on my web site.

    Please anyone suggest on this one.


    Best Regards,
    Surapong

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    How are you running PHP: SuPHP, CGI, FastCGi, DSO (Apache Module) ?

  3. #3
    Member
    Join Date
    Aug 2009
    Posts
    8

    Default

    Yes, I am running on suPHP.

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by surapong View Post
    Yes, I am running on suPHP.
    You can only use php_flag in .htaccess or httpd.conf if you are using DSO. You can read more about this at:

    ApachePHPRequestHandling < EasyApache3 < TWiki

  5. #5
    Member linux7802's Avatar
    Join Date
    Dec 2007
    Posts
    224
    cPanel/Enkompass Access Level

    Root Administrator

    Default Solution

    Yes basically following error message occur ".htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration" due to suPHP enabled on server due to that you can't define the php values in .htaccess file.But you can manage php values by by using php.ini file under each directory where you want.

    For example if you want to enable the register_globals for domain name test.com then you need to be create php.ini file under the public_html with the content "register_globals = On".It will enable the register_globals for that domains public_html folder only.

    If your script installed under the public_html i.e public_html/test folder which required the register_globals enabled then you also need to create new php.ini file with the content "register_globals = On" to enable it for the entire folder public_html/test. Because php.ini file is working on directory basis and each directory required its own php.ini file to change the php values.
    Regards,
    G R Sonar
    cPanel Hosting Blog

  6. #6
    Member
    Join Date
    May 2008
    Posts
    1,203

    Default

    PHP flags and values (php_flag / php_value) can not be override from .htaccess file since you have suPHP enabled. Please follow the steps provided by linux7802 to get it working.

  7. #7
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Exclamation

    Linux7802 is partially correct in that you do need a custom PHP.INI file to override PHP settings but the instructions they gave you pertain to phpSuExec and not to SuPHP which actually operates a bit differently.

    Click here for more information on setting up custom PHP.INIs under SuPHP.

    Now addressing the broader issue, as you have already found out, any
    attempt to insert "PHP_FLAG" or "PHP_VALUE" commands in .htaccess
    when running PHP as SuPHP will trigger an Error 500 condition for your site
    and the only way you can override PHP commands is via a custom PHP.INI
    using the suPHP_ConfigPath command or with PHP's ini_set() function.

Similar Threads & Tags
Similar threads

  1. Replies: 4
    Last Post: 09-13-2010, 11:26 PM
  2. .htaccess Issue causing FTP to fail even from cPanel file editor
    By cmariomej in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 11-23-2008, 10:45 PM
  3. Advice on php_flag AddHandler and Action
    By icemarkuk in forum New User Questions
    Replies: 5
    Last Post: 06-28-2005, 08:06 PM
  4. Host command fail- 3(NXDOMAIN)
    By SupermanInNY in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-16-2003, 08:24 AM
  5. Xinetd services fail fail fail!
    By ozzi4648 in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 01-06-2003, 05:34 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube