Ahosting Logo
Knowledge Base

How to Configure PHP Settings in cPanel

Different web applications require different PHP configurations. cPanel allows you to change PHP versions and settings for your hosting account.

Changing PHP Version

  1. Log into cPanel
  2. Go to Software section
  3. Click MultiPHP Manager or Select PHP Version
  4. Check the domain(s) you want to change
  5. Select PHP version from dropdown
  6. Click Apply

Available PHP Versions

Ahosting typically offers:

  • PHP 7.4 (legacy support)
  • PHP 8.0
  • PHP 8.1
  • PHP 8.2
  • PHP 8.3 (latest)

Recommendation: Use the latest PHP version your application supports for best performance and security.

Modifying PHP Settings (php.ini)

  1. Go to Software > MultiPHP INI Editor
  2. Select your domain
  3. Modify settings as needed
  4. Click Apply

Common PHP Settings

Setting Default Purpose
upload_max_filesize 2M Maximum file upload size
post_max_size 8M Maximum POST data size
max_execution_time 30 Script timeout in seconds
memory_limit 128M Maximum memory per script
max_input_vars 1000 Maximum form variables
max_input_time 60 Input parsing timeout

Enabling/Disabling PHP Extensions

  1. Go to Software > Select PHP Version
  2. Click your current PHP version
  3. Check/uncheck extensions
  4. Click Save

Common PHP Extensions

  • mysqli / pdo_mysql: MySQL database connectivity
  • curl: HTTP requests
  • gd / imagick: Image processing
  • zip: ZIP file handling
  • mbstring: Multibyte string handling
  • intl: Internationalization
  • opcache: PHP code caching (performance)

WordPress Recommended Settings

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
memory_limit = 256M
max_input_vars = 3000

Creating Custom php.ini

For per-directory PHP settings, create a php.ini file in that folder:

  1. Go to File Manager
  2. Navigate to the directory
  3. Create a file named php.ini
  4. Add your settings:
    upload_max_filesize = 128M
    post_max_size = 128M

Checking Current PHP Settings

Create a phpinfo file to view all settings:

  1. Create a file phpinfo.php in public_html
  2. Add: <?php phpinfo(); ?>
  3. Visit yourdomain.com/phpinfo.php
  4. Delete this file after checking (security risk)

Troubleshooting

  • Changes not working: Clear browser cache and site cache
  • 500 error after change: Revert PHP version or settings
  • Extension not available: Contact support to enable