Learn how to change the PHP version via .htaccess in cPanel. Our cPanel Support team is here to help you with your questions and concerns.
How to Change PHP Version via .htaccess in cPanel
Did you know that changing the PHP version for the website is important when it comes to compatibility with specific applications or to improve performance?
We can easily change the PHP version for our site using cPanel, either via the cPanel interface for single websites or by modifying the `.htaccess` file for multiple websites.
Before implementing the PHP version change, we have to make sure the hosting account supports the desired PHP version
Changing PHP Version via cPanel Interface
If we need to change the PHP version for a single website, follow these steps:
- First, log into cPanel to access the cPanel account.
- Then, find the “Select PHP Version” or similar option in the cPanel interface.
- After that, select the preferred PHP version from the dropdown menu.
- Next, click the “Apply” or “Save” button to confirm the change.
Changing PHP Version via .htaccess File
For multiple websites within one cPanel account, we can specify different PHP versions by modifying the `.htaccess` file for each site:
- First, log in to the cPanel account using our credentials.
- Then, locate and click on the “File Manager” option within the cPanel interface.
- Before making changes, note the current PHP version in the “Server Info” section.
- Next, go to the root directory of the website where the `.htaccess` file is located. If it doesn’t exist, we have to create one.
- Then, right-click on the `.htaccess` file and select “Edit” or “Code Edit.”
- Now, change the PHP version to 7.4 and add the following code to the `.htaccess` file:
# Use PHP74 as default
AddHandler application/x-httpd-php74 .php
<IfModule mod_suphp.c>
suPHP_ConfigPath /opt/php74/lib
</IfModule>
We have to replace `74` with the preferred PHP version number.
- After making the changes, click on “Save Changes” at the bottom of the editor or “Save & Close” in the top right corner.
By following the above steps we can easily adjust the PHP version for our website using cPanel. Whether we are changing the version for a single site through the cPanel interface or managing multiple sites with `.htaccess` modifications, these methods ensure that our websites run smoothly with the correct PHP versions.
[Need assistance with a different issue? Our team is available 24/7.]
Conclusion
In brief, our Support Experts demonstrated how to change the PHP Version via .htaccess in cPanel.
0 Comments