Get your free beta license ↗
Websites · Apache

A site fails with “Invalid command 'php_value'”

Last updated 30 Nov 2026
Summary

A site returns 500 Internal Server Error because its .htaccess contains a php_value or php_flag line. Apache does not recognize these directives here because PHP runs through PHP-FPM, so move the values to the domain's PHP settings.

Symptoms

Every page of the site returns 500 Internal Server Error. Read the domain's error log with the following command.

urbestack-domain-log --name example.com --type error
Output
[Mon Nov 30 08:12:29.273001 2026] [core:alert] [pid 1377:tid 1417] [client 203.0.113.10:40618] /home/USER/files/web/example.com/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration

Cause

UrbeStack runs each site's PHP in its own PHP-FPM pool. Apache passes PHP requests to that pool.

php_value and php_flag are directives from mod_php, the PHP module for Apache. These servers do not load that module. Apache rejects the entire .htaccess file, so every page fails.

Resolution

  1. Delete the php_value and php_flag lines from .htaccess. The site responds again immediately.

  2. Set the values in the domain's PHP settings. This example sets memory_limit.

    urbestack-domain-set --name example.com --php-setting memory_limit=512M
  3. The command accepts memory_limit, upload_max_filesize, post_max_size, max_execution_time, max_input_vars, disable_functions, display_errors and date.timezone.

  4. You can also set display_errors and date.timezone in a .user.ini file in the site's folder.