Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We currently have a dedicated server with one company that is running apache, php, mysql etc. It currently has whm/cpanel installed. We are migrating to a new server with cpanel/whm. Everything migrated over fine but now one of my sites has some php_flag and php_value lines in the .htaccess file. When I go to the site on this new server I am getting 500 errors that read Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration.

I am not sure what I need to do to get these to work so any help would be greatly appreciated.

share|improve this question
up vote 9 down vote accepted

Putting php_flag etc in .htaccess is only possible when you are using mod_php. With CGI/FCGI, Apache settings cannot be used to configure PHP since it is not running within Apache.

Using CGI, if you need a site with a custom php.ini, the exact details would depend on how exactly you're running the PHP (CGI, mod_fastcgi (with or without php-fpm), mod_fcgid). For basic CGI you will need to create an alternate Action for php files in that site that executes a wrapper script containing something like /usr/bin/php5-cgi -c /some/alternate/php.ini

share|improve this answer
Ahh Makes sense now. Thank you very much. – mahle May 24 '11 at 18:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.