PHP - Enabling / Disabling Properties

This article explains how to enable or disable PHP properties for a specific account on a Linux dedicated server with cPanel/WHM.

Important: The configuration method depends on how PHP is implemented on your server: PHPSuExec / CGI, Apache module, or FastCGI. First identify which one you use before editing files.

Determine the PHP Implementation Type

  1. Connect via SSH with the root user (see the SSH access article in this category).
  2. Enter an account's web directory, for example:
    cd /home/USER/public_html
  3. Create a phpinfo.php file with this content:
    <?php phpinfo(); ?>

    With vi: run vi phpinfo.php, press i to insert, paste the code, press Esc, type :wq and Enter.

  4. Assign permissions and owner to the file (replace USER with the account):
    chown USER:USER phpinfo.php
    chmod 644 phpinfo.php
  5. Open in browser: http://yourdomain.com/phpinfo.php
  6. Look for the Server API line and note the value.
Server API Value Implementation
CGI / CGI/FastCGI PHPSuExec or similar environment → use php.ini per directory.
Apache, Apache 2.0 Handler or another Apache variant PHP as Apache module → use .htaccess.
FastCGI Configuration in cgi-bin + .htaccess (see FastCGI section).

Security: Delete phpinfo.php when you finish verifying the implementation. Do not leave it published in production.

Configuration with PHPSuExec / CGI (php.ini file)

Place a php.ini file inside the web directory where you want to apply the changes (e.g. public_html).

Note: php.ini directives are not recursive. If you need different values in subfolders, create a php.ini in each directory.

Syntax:

directive = value

; Examples:
display_errors = Off
memory_limit = 256M
max_execution_time = 120
upload_max_filesize = 64M

Configuration with Apache Module (.htaccess file)

Edit or create the .htaccess file in the account's public_html.

Syntax:

php_flag directive value
php_value directive value

; Examples:
php_flag display_errors Off
php_value memory_limit 256M
php_value max_execution_time 120

Attention: php_flag and php_value only work if PHP runs as an Apache module. If your Server API is CGI, these directives in .htaccess can cause a 500 error.

Configuration with FastCGI

  1. Enter the account's cgi-bin directory:
    cd /home/USER/public_html/cgi-bin
  2. Copy the global php.ini and adjust permissions:
    cp /usr/local/lib/php.ini .
    chown USER:USER php.ini
  3. Create the php5.fcgi file with this content:
    #!/bin/sh
    export PHP_FCGI_CHILDREN=1
    export PHP_FCGI_MAX_REQUESTS=10
    exec /usr/local/cpanel/cgi-sys/php5
  4. Assign owner and execution permissions:
    chown USER:USER php5.fcgi php.ini
    chmod 755 php5.fcgi
  5. Add these lines to the public_html .htaccess:
    AddHandler php5-fastcgi .php
    Action php5-fastcgi /cgi-bin/php5.fcgi
  6. Edit the necessary directives in the php.ini copied to cgi-bin.

Verify that changes applied

  • Check phpinfo.php again and look for the modified directive in the Local Value table.
  • If the site returns a 500 error after editing .htaccess or php.ini, revert the last change and test one directive at a time.
  • On servers with recent cPanel, you can also check MultiPHP INI Editor from WHM or cPanel before editing files manually.

Common issues

  • 500 Error when saving .htaccess: you are probably using Apache module directives in a CGI environment; switch to the php.ini method.
  • Changes do not apply: verify that the file is in the correct directory and that there is no other php.ini or .htaccess in a subfolder with different priority.
  • FastCGI does not execute: check 755 permissions on php5.fcgi and make sure the path /usr/local/cpanel/cgi-sys/php5 exists in your cPanel version.
  • Directive not allowed: some options are locked globally in WHM (PHP Configuration Editor).

If you cannot identify the PHP implementation, a directive does not apply, or the site becomes inaccessible after the changes, open a ticket from the client portal or consult via the site's online chat.

  • propiedades servidor
  • 62 Users Found This Useful
Was this answer helpful?

Related Articles

Configure PuTTY for SSH

This article complements the SSH access guide and explains how to configure PuTTY to connect to a...

Reseller - Create a reseller account on a dedicated server

This article explains how to create a reseller account or convert an end-user account into a...

Change root password in WHM

This article explains how to change the root user password of a Linux dedicated server from WHM,...

DNS with custom nameservers

This article explains how to request and configure custom nameservers (for example...

Dedicated Servers - Generate a CSR file in Apache

This article explains how to generate a CSR (Certificate Signing Request) file using OpenSSL to...