Changing the PHP version in cPanel allows you to utilize features and improvements available in newer PHP releases or to maintain compatibility with your web applications. Here’s a step-by-step guide on how to change the PHP version in cPanel.

What You’ll Learn:

  1. Accessing the PHP version manager.
  2. Selecting the desired PHP version.
  3. Saving and verifying changes.

1. Log in to cPanel

Start by logging into your cPanel account:

  • Go to your cPanel login URL (usually yourdomain.com/cpanel).
  • Enter your username and password.

2. Access the PHP Version Manager

Depending on your hosting setup, you might see either MultiPHP Manager or PHP Selector.

A. Using MultiPHP Manager

  1. In the Software section of your cPanel dashboard, click on MultiPHP Manager.

B. Using PHP Selector

  1. If you see Select PHP Version, click on it in the Software section.

3. Change the PHP Version

A. In MultiPHP Manager

  1. Select Your Domain: You’ll see a list of your domains and their currently assigned PHP versions.
  2. Choose the New PHP Version:
    • Select the checkbox next to the domain you want to change.
    • From the dropdown menu labeled PHP Version, choose the desired PHP version.
  3. Apply Changes: Click the Apply button to save your changes.

B. In PHP Selector

  1. Select Your Domain: From the dropdown menu, select the domain for which you want to change the PHP version.
  2. Choose the Desired Version:
    • Select the desired PHP version from the dropdown menu at the top.
  3. Save Changes: Click the Save or Set as Current button to apply your selection.

4. Verify the PHP Version Change

To confirm that the PHP version change was successful:

  1. Create a PHP Info File:
    • In the File Manager, navigate to your website’s root directory (usually /public_html).
    • Create a new file named phpinfo.php.

Add the following code to the file:
php
Copy code
<?php

phpinfo();

?>

  • Save the file.
  1. Open the PHP Info Page:
    • In your web browser, go to yourdomain.com/phpinfo.php.
    • Look for the PHP Version section at the top of the page. This will display the currently active PHP version.

5. Best Practices

  • Compatibility Check: Before changing the PHP version, ensure that your applications and scripts are compatible with the new version.
  • Backup: Always back up your website and databases before making significant changes.
  • Test Your Site: After changing the PHP version, thoroughly test your website to ensure everything functions correctly.

Conclusion

Changing the PHP version in cPanel is a simple process that can improve your website's performance and compatibility. By following these steps, you can easily select the appropriate PHP version for your applications and ensure that your site runs smoothly.

آیا این پاسخ به شما کمک کرد؟ 0 کاربر این را مفید یافتند (0 نظرات)