![]() |
|
Guide Fix: 502 Bad Gateway after switching a site's PHP version in aaPanel - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels) +--- Forum: aaPanel (https://adminsforum.com/Forum-aapanel) +--- Thread: Guide Fix: 502 Bad Gateway after switching a site's PHP version in aaPanel (/Thread-guide-fix-502-bad-gateway-after-switching-a-site-s-php-version-in-aapanel) |
Fix: 502 Bad Gateway after switching a site's PHP version in aaPanel - JAY - 10-06-2026 How do you fix a 502 after changing PHP version in aaPanel? Check the site's Nginx error log, confirm its selected PHP version, and verify that the matching PHP-FPM service is healthy and listening where Nginx expects it. Restore the last working selection if necessary and application-compatible. A 502 alone does not identify the cause. Scope and review: Documentation reviewed 9 October 2026. This covers Nginx with panel-managed PHP-FPM after a PHP-version change, not every 502 or an OpenLiteSpeed/Apache deployment. Fresh-VPS reproduction and screenshots are pending. Record aaPanel, OS, Nginx and PHP versions. PHP 8.3 and example.com below are placeholders. 1. Correlate the failure with the site's error log Confirm the actual log path in aaPanel and reproduce one failing request: Code: sudo tail -n 50 /www/wwwlogs/example.com.error.logCode: connect() to unix:/tmp/php-cgi-83.sock failed (2: No such file or directory)Different messages need different checks:
2. Check the selected PHP service Prefer the panel's PHP service controls. If this installation uses the documented init script, an example status check is: Code: sudo /etc/init.d/php-fpm-83 status
ls -l /tmp/php-cgi-83.sock3. Inspect startup/configuration errors A configuration check for this example installation: Code: sudo /www/server/php/83/sbin/php-fpm -tCode: sudo /etc/init.d/php-fpm-83 start4. Validate Nginx only if its configuration changed Use the panel-managed binary on this example installation: Code: sudo /www/server/nginx/sbin/nginx -t5. Verify recovery and keep a rollback path
For help: Share the version details, selected PHP version, time of failure and a few redacted error lines. Do not share credentials, tokens or a full configuration dump. Official references: aaPanel PHP selection and logs; Nginx FastCGI upstreams; PHP-FPM configuration. Related: aaPanel file and log locations ยท Setup checklist. |