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.
# 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.
php -v
# Check all installed PHP binaries:
ls /usr/local/php*/bin/php 2>/dev/null || ls /usr/bin/php* 2>/dev/null
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.
# 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).
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.
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.
# 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
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
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
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
# 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
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
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.
