DirectAdmin PHP Version Not Changing? Fix PHP Selector Per Domain

Priya

Content Writer & Researcher

Last Updated: 26 July 2026
DirectAdmin PHP Version Not Changing? Fix PHP Selector Per Domain
πŸ–₯️

Struggling With PHP Version Conflicts Across Your DirectAdmin Servers?

Wrong PHP versions break applications silently and debugging them eats hours. CloudHouse manages PHP version assignments, CustomBuild configurations, and PHP-FPM pools across your DirectAdmin fleet so your sites always run the right version.

πŸ–₯️12,400+PCs Fixed
⭐4.9β˜…Google Rating
⚑<15 minAvg. Response
πŸ›‘οΈISO 27001Certified

You changed the PHP version for a domain in DirectAdmin's control panel, hit Save β€” and ran php -v on the command line to find it's still reporting PHP 7.4. Or you checked the domain's phpinfo() page and it shows a different version than what you selected in the PHP Selector. DirectAdmin's multi-PHP setup involves three separate layers: the CustomBuild configuration, the domain's .conf file, and the PHP-FPM pool. When they fall out of sync, the version change appears to work but doesn't take effect.

This guide walks through each layer, how to verify what version is actually running, and how to force every component to use the correct PHP version.

πŸ’‘ None of these worked? Skip the guesswork.

Get Expert Help β†’

Step 1: Verify Which PHP Version Is Actually Running Per Domain

Before making any changes, confirm the discrepancy. The PHP Selector UI may show one version while the web server serves another.

1Check the web server PHP version via phpinfo()
# Create a temporary phpinfo file in the domain's document root
echo "" > /home/USERNAME/domains/DOMAIN.COM/public_html/phptest.php

Visit https://yourdomain.com/phptest.php in a browser. Look for the PHP Version line at the top. Delete the file immediately after checking.

2Check the CLI PHP version (often different from web)
php -v
# Check all installed PHP binaries:
ls /usr/local/php*/bin/php 2>/dev/null || ls /usr/bin/php* 2>/dev/null
3Read the domain's PHP assignment directly
grep "php" /usr/local/directadmin/data/users/USERNAME/domains/DOMAIN.COM.conf

Look for the php1_select field. Valid values are php1, php2, php3, etc., corresponding to the PHP versions defined in CustomBuild's options.conf.

1Edit the domain .conf to set the correct PHP slot
# View the current PHP slot assignments in CustomBuild
cat /usr/local/directadmin/custombuild/options.conf | grep -E "^php[0-9]_release"

Example output:

php1_release=8.2
php2_release=8.1
php3_release=7.4

Now edit the domain conf:

vi /usr/local/directadmin/data/users/USERNAME/domains/DOMAIN.COM.conf

Change php1_select=php1 to the slot matching your target version (e.g., php1_select=php3 for PHP 7.4).

2Force DirectAdmin to regenerate the Apache/nginx vhost
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d380 --custombuild

Or trigger a full vhost rewrite:

echo "action=rewrite&value=all" >> /usr/local/directadmin/data/task.queue

DirectAdmin's task queue processor picks this up within a few seconds and rewrites all virtual host configurations. Check /var/log/directadmin/errortaskq.log if the change doesn't take effect.

1Force CustomBuild to rewrite all PHP-FPM and Apache configs
cd /usr/local/directadmin/custombuild
./build rewrite_confs

This rewrites all Apache, nginx, and PHP-FPM configuration files from scratch based on the current options.conf and domain assignments.

2Restart the PHP-FPM service for the target version
# For PHP 8.2 (adjust version number):
systemctl restart php-fpm82
# or
/etc/init.d/php82-fpm restart

# List running PHP-FPM processes to confirm:
ps aux | grep php-fpm | grep -v grep
3Verify the correct PHP-FPM socket exists
ls -la /var/run/php-fpm/
# Expected: one socket per installed PHP version
# e.g.: php-fpm82.sock, php-fpm81.sock, php-fpm74.sock

If a socket is missing, the corresponding PHP-FPM service is not running. Start it:

systemctl start php-fpm82
systemctl enable php-fpm82
1Set the default PHP version for new domains

In DirectAdmin admin panel, go to Admin Level β†’ PHP Versions and set the default version. Alternatively, edit the DirectAdmin config directly:

grep "php_default_version" /usr/local/directadmin/conf/directadmin.conf
# Set it:
echo "php_default_version=php1" >> /usr/local/directadmin/conf/directadmin.conf
2Verify the php_version_selector is enabled
grep "php_version_selector" /usr/local/directadmin/conf/directadmin.conf

It must be set to 1. If the key is missing, add it:

echo "php_version_selector=1" >> /usr/local/directadmin/conf/directadmin.conf
service directadmin restart
1Update the CLI PHP symlink
# View available PHP binaries:
ls /usr/local/php*/bin/php

# Point the system php symlink to the desired version (e.g., 8.2):
ln -sf /usr/local/php82/bin/php /usr/bin/php
php -v  # Verify
2Set per-user CLI PHP version via .bashrc

For a specific cPanel or hosting user rather than system-wide:

echo 'export PATH="/usr/local/php82/bin:$PATH"' >> /home/USERNAME/.bashrc
source /home/USERNAME/.bashrc
php -v
3Fix cron jobs using the wrong PHP version

Cron jobs that call php use the system symlink. Specify the full path to the correct PHP binary in cron entries:

# Wrong β€” uses system default which may be wrong version:
* * * * * php /home/user/artisan schedule:run

# Right β€” explicit binary path:
* * * * * /usr/local/php82/bin/php /home/user/artisan schedule:run

Step 6: Verify the Fix End-to-End

After making changes, verify all three layers are consistent.

# 1. Web server PHP version (via CLI phpinfo parse):
curl -s "https://yourdomain.com/phptest.php" | grep "PHP Version" | head -1

# 2. PHP-FPM is running the right version:
ps aux | grep php-fpm

# 3. CLI PHP version:
php -v

# 4. Domain conf assignment:
grep "php1_select" /usr/local/directadmin/data/users/USERNAME/domains/DOMAIN.COM.conf

All three should match your target version. Remove the phptest.php file immediately after verification.

PHP version mismatches in DirectAdmin almost always come from one of four causes: the domain .conf file not being updated, PHP-FPM not being restarted after a version change, CustomBuild configs not being rewritten, or the PHP selector feature being disabled globally. Work through the steps above in order and the version discrepancy will be resolved without affecting other domains on the server. If you manage DirectAdmin servers at scale and want PHP upgrades and version assignments handled without manual intervention, CloudHouse's server management service covers PHP configuration management as part of your monthly plan.

Get the Free Linux Server Admin Cheatsheet (PDF)

Essential commands for server management, networking, and troubleshooting β€” all on one printable page.

Running Linux servers? Let us manage them for you.

Our Managed Linux Server plans cover updates, security hardening, monitoring, and 24/7 incident response β€” so your servers stay up and your team stays focused.

  • Proactive OS patching and security updates
  • 24Γ—7 monitoring with instant alerting
  • Backup configuration and disaster recovery
  • Dedicated Linux engineers on call
See Pricing Plans β†’

What our customers say

β€œOur production server went down at 2 AM. CloudHouse had it back online in under 20 minutes. Incredible response time.”

Arun S.

CTO, SaaS Startup

β€œThey migrated our entire infrastructure from Ubuntu 18 to 22 with zero downtime. Couldn't have asked for better.”

Deepak N.

DevOps Lead

Frequently Asked Questions

The PHP Selector UI saves the change to the domain's .conf file, but the Apache/nginx vhost must be regenerated for the change to take effect. Run: echo 'action=rewrite&value=httpd' >> /usr/local/directadmin/data/task.queue to trigger a vhost rewrite. If the vhost updates but PHP-FPM still serves the old version, restart the new version's PHP-FPM service: systemctl restart php-fpm82.

Need this done for you?

Server Management Service

Managed Linux and Windows servers: monitoring, patching, security and 24/7 support.

Learn more

Book your free 15-minute diagnosis

A certified technician will call you back within 15 minutes during business hours.

Share this article

Leave a Comment

Comments (0)

Loading comments...