How do I activate different PHP settings for added companion domains?

Procédure

Why add different PHP on companion domains?

You may be using companion domains to host other websites on your cPanel hosting. However, some of the sites you are going to set up will need a PHP version other than the base version in order to function. It will therefore be necessary to be able to modify the PHP version for companion domains via an .htaccess file.

How do I activate different PHP versions for added companion domains?

The .htaccess file should be placed in the directory associated with the companion domain you have added.

If you use a popular CMS such as WordPress or Prestashop for example, an .htaccess file is already present in the root folder of your website.

Depending on the version of PHP you want to use on your site, you will need to add the following lines to the .htaccess file:


SetHandler application/x-httpd-alt-phpXX___lsphp

⚠️ Warning: you need to change the value "phpXX" in the example above to the PHP version you want to use (e.g. php56 for PHP version 5.6, php72 for PHP version 7.2, etc.).

Conclusion

You now know how to :

  • Use companion domains to host multiple websites on a single cPanel hosting 😊,
  • Modify the PHP version for a specific companion domain using an .htaccess file 🛠️,
  • Insert the appropriate code in the .htaccess file to activate the desired PHP version 🔄.

We hope this information will help you optimise your sites hosted on cPanel and take full advantage of the flexibility offered by the different versions of PHP. Thank you for reading and feel free to leave a comment to share your experience or ask any questions 📝. Good luck with your digital projects! 😄👍

Rate this article :

3.7/5 | 3 opinion

This article was useful to you ?

Article utileYes

Article non utileNo

Vous souhaitez nous laisser un commentaire concernant cet article ?

Si cela concerne une erreur dans la documentation ou un manque d'informations, n'hésitez pas à nous en faire part depuis le formulaire.

Pour toute question non liée à cette documentation ou problème technique sur l'un de vos services, contactez le support commercial ou le support technique

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

1mn reading

Use PHP Selector to activate PHP extensions on cPanel

1mn reading

How do I change the PHP version of my cPanel hosting?

1mn reading

How do I change max_upload_size and max_execution_time on cPanel?


Ask the LWS team and its community a question