Enable PHP optimisation with OVHcloud Web Hosting
This guide will show you how to enable PHP-FPM on your hosting package with OVHcloud in order to improve the PHP response time
This guide will show you how to enable PHP-FPM on your hosting package with OVHcloud in order to improve the PHP response time
Last updated 5th May 2020
We have adapted PHP-FPM to our web infrastructure so that you can enjoy speedier PHP response times.
It is compiled by caching the opcode which minimises slow disk reads and speeds up the processes your PHP code.
Tests have shown that performance is up to 7 times faster compared with the older mechanism.
This guide will explain how to enable PHP FPM and select the PHP version by using the .ovhconfig file. Alternatively you can do this straight from your customer account by following this guide.
Warning: the following options are disabled for safety reasons when using PHP-FPM
register_globals
magic_quotes_gpc
For magic_quote_gpc:
PHP 5.4: magic_quotes_gpc disabled
PHP 5.4: magic_quotes_gpc disabled PHP 5.5: magic_quotes_gpc disabled
You are advised to use the latest versions of PHP (5.5 or 5.6) as older versions are not kept up-to-date by the publisher and may contain security vulnerabilities.
Just save the .ovhcongig file at the root of your disk space, via your FTP client.
PLEASE NOTE: The .ovhconfig file exists by default on 2014 Web Hosting packages. On older packages you have to create it and save it at the root of your disk space. It is not automatically added to the older plans or when changing your plan, some settings may not be compatible depending on the version of PHP that you are using.
NB: the .ovhconfig file can only be placed at the root or in a top-level directory. It is not possible to have multiple files with different versions of PHP on the same hosting package (except Multisites).
This .ovhconfig should contain the following code:
app.engine=php
app.engine.version=5.6
http.firewall=none
environment=production
If the PHP-FPM engine crashes, the old PHP engine will be activated as fall-back.
You can use the following versions of PHP:
PHP 5.3
ionCube is also available
Warning: once the .ovhconfig is uploaded, the PHP version used is the one selected by app.engine.version. The variables of your .htaccess file such as SetEnv PHP_VER are ignored.
This error means that the engine or version specified in your .ovhconfig file does not exist. Please look at your website's error log to get more information on this.
It allows you to specify static file caching and the behaviour of PHP errors. In development mode:
In production mode:
This directive allows you to enable a web application firewall (ModSecurity)
http.firewall defaults to none
Yes, IonCube is now available with versions
To use it, you have to use the IonCube encoder to encode your PHP scripts, these will then work on your shared hosting package. For more information see the IonCube FAQ: IonCube FAQ
Just add the following to your .ovhconfig file:
app.engine=phpcgi
app.engine.version=AUTO
Here are the details of the config application file:
; ovhconfig
;
; this file must be placed in $HOME/.ovhconfig or in $DOCUMENT_ROOT/.ovhconfig
; __app.engine__
;
; values: php (php engine + opcache accelerator)
; notice: if php, a phpcgi engine will be activated as fallback (if previous engine crash)
;
; php:
; IMPORTANT: register_globals and magic_quotes_gpc are off for security
; php optiones .htaccess (like php version) are ignored
; phpcgi:
; IMPORTANT this is a fallback to previous system
; in this case __app.engine.version__ will be considerated as AUTO and php version will be old system
; (meaning depending .htaccess or .phpX extension)
;
app.engine=php
; __app.engine.version__ specify version of your engine
;
; for php:
; default: 5.6
; for phpcgi:
; this options is ignored (= fallback in AUTO)
;
app.engine.version=5.6
; __http.firewall__ used to add application firewall (filter http requests)
;
; values: none | security
; default: none
;
http.firewall=none
; __environment__
;
; values: production | development
;
; production:
; apache will maximise local cache
; mod_expires will grow up TTL of js, css, pdf, images, video, audio
; you can override it changing expiration explicitly in your .htaccess
; feel free to look on our guide.
; development:
; no expiration is added, files are not locally in cache,
; will speed up tests but decrease performances
;
; choosen environment will also be available in your variable ENVIRONMENT unix env
;
; default: production
;
environment=development
Join our community of users on https://community.ovh.com/en/.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community