The Wild

Restore PHP Selector Options After Migration

· 5 min read · Mammals

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

After migrating a website or restoring a backup, your PHP selector may show only the default version or miss custom PHP settings. This guide explains how to restore PHP selector options in cPanel, Plesk, or DirectAdmin so your site runs with the correct PHP version and extensions.

What You'll Need

  • Access to your hosting control panel (cPanel, Plesk, or DirectAdmin).
  • Your hosting account credentials (username and password).
  • If you have a backup, know where it is stored (local or remote).
  • If you use custom PHP settings (like php.ini or .user.ini), have those files ready.

Step-by-Step

  1. Log into your hosting control panel. Open your browser, go to your hosting provider's login URL, and enter your credentials.
  2. Locate the PHP Selector tool. In cPanel, look for "Select PHP Version" under the Software section. In Plesk, go to "PHP Settings" under the domain you want to configure. In DirectAdmin, find "PHP Selector" in the Advanced section.
  3. Check the current PHP version. The tool will show the currently selected version. If it's not the one you need, change it to the version your site requires (e.g., 7.4, 8.0, 8.1).
  4. Enable required PHP extensions. In the PHP Selector, you'll see a list of extensions (like mysqli, curl, gd). Tick the ones your site needs. If you're unsure, check your site's error logs or your application's documentation.
  5. Restore custom php.ini settings. If you had custom PHP directives (like memory_limit or upload_max_filesize), create a php.ini file in your public_html (or document root) with those settings. For cPanel, you can also use the "MultiPHP INI Editor" to adjust values per domain.
  6. Restore .user.ini files. If your site used .user.ini files (common with WordPress), upload them back to the relevant directories. These files override php.ini settings on a per-directory basis.
  7. Clear opcode caches. After making changes, clear any PHP opcode caches (like OPcache) by restarting PHP or using the control panel's "Restart PHP" button if available. This ensures the new settings take effect.
  8. Test your site. Load your homepage and a few key pages. Check for PHP errors or blank screens. Use your site's error logs if something fails.
  9. Verify with phpinfo(). Create a temporary file named phpinfo.php in your public_html with the content <?php phpinfo(); ?> and open it in your browser. Check the PHP Version and Loaded Configuration File to confirm everything is correct. Delete the file after testing.

Common Mistakes

  • Forgetting to re-enable extensions: After migration, extensions are often disabled by default. Your site may show errors like "Call to undefined function" if you forget to enable them.
  • Using the wrong PHP version: Some applications require a specific PHP version. Running a newer or older version can cause compatibility issues.
  • Not restoring custom ini files: If you had custom php.ini or .user.ini files, they must be uploaded again. Without them, your site may have low memory limits or upload sizes.
  • Ignoring error logs: If something goes wrong, check the error logs first. They will tell you exactly what's missing or misconfigured.
  • Leaving phpinfo.php on the server: This file exposes sensitive information. Always delete it after testing.

Tips

  • Before migrating, take a screenshot of your PHP Selector settings. This gives you a reference for what to restore.
  • Export your php.ini and .user.ini files from the old server and keep them with your backup.
  • If your site uses a CMS like WordPress, check the official requirements for PHP version and extensions.
  • Use a staging environment to test PHP settings before applying them to production.
  • If you're unsure which extensions to enable, start with the ones your site's error logs mention, then add more as needed.

Troubleshooting

Site shows a blank page after changing PHP version: This usually means a PHP error occurred. Check the error log (in cPanel, under "Errors" or in the "Metrics" section). Common fixes: enable the missing extension or switch back to the previous PHP version temporarily.

PHP Selector shows no options or only one version: Your hosting provider may have limited the available versions. Contact support to ask if you can enable more versions. In some cases, you may need to use a custom PHP installation via CGI/FastCGI.

Changes don't take effect: Clear your browser cache and any server-side caches (like OPcache). If you're using a CDN, purge its cache as well. Also, wait a few minutes for the server to update.

Error: "PHP Extension not found" during installation: The extension may not be installed on the new server. Check with your host if it's available. If not, you may need to use a different extension or request installation.

Site works but performance is slow: You might be using an older PHP version. Upgrade to a newer supported version (e.g., 8.x) for better performance. Also, ensure OPcache is enabled.

Frequently Asked Questions

Do I need to restore PHP settings if I only migrated files?

Yes, because PHP settings are server-specific. The new server likely has different default PHP versions and extensions, so you must reconfigure them.

Can I restore PHP settings from a backup of the old server?

If your backup includes configuration files like php.ini or .user.ini, you can upload them. However, PHP Selector settings (like which version is selected) are stored in the hosting control panel, not in the files, so you need to set those manually.

What if my hosting provider doesn't offer PHP Selector?

Some providers use a different interface. Check if they offer "PHP Settings" or "PHP Configuration" in the control panel. If not, you may need to use .htaccess to set PHP version (e.g., AddHandler application/x-httpd-php7.4 .php), but this is less common.

Why did my PHP extensions disappear after migration?

Extensions are part of the server's PHP installation, not your site's files. When you move to a new server, the default set of extensions may differ. You need to re-enable the ones your site needs.

How do I know which PHP version my site needs?

Check your application's documentation. For WordPress, any PHP 7.4 or above works, but 8.0+ is recommended. For custom code, consult your developer or check the error logs.

Is it safe to switch to a newer PHP version?

Generally, yes, but test first. Newer versions are faster and more secure, but some old code may break. Always test in a staging environment before making the switch on your live site.