Development and databases
PHP version on a website published with Deploy+
Deploy+ can publish a repository to any folder on your hosting: public_html, a domain's or subdomain's folder, or a folder inside another website. For those folders, the PHP section of the client area shows which version the website runs on, but it does not let you change it or set a version on anything below them.
Why it cannot be changed from the client area
Deploy+ prepares each deployment in a new folder and, when it is ready, points the published folder at it. If the client area wrote the version into the published folder's .htaccess, that line would stay in the deployment that was active. On the next one, the website would go back to the previous version without warning.
That is why, on a website published with Deploy+, the version is decided in one of these two places.
In your repository's .htaccess
This is the recommended option when the website needs a specific version: the version travels with the code and arrives the same on every deployment.
-
In your repository, open the
.htaccessof the web root, the repository folder that gets published. In Laravel or Symfony it is usuallypublic/; in WordPress or a plain PHP project, the root of the repository. You can see it in Deploy+, in the repository settings, as Web root. If the file does not exist, create it. -
Add the directive for the version you need. For example, for PHP 8.3:
AddType application/x-httpd-alt-php83 .phpThe number is the version without the dot:
82for PHP 8.2,74for PHP 7.4. The full list is in Different PHP versions per directory or domain. -
If the file already has a line with
x-httpd-alt-php, do not add another: just change the number. -
Commit and deploy.
The version applies to the web root and everything below it. For a specific folder in the project, put the directive in that folder's .htaccess.
With the account's default version
If the website does not have its own version, it uses the account's default version. That one can be changed from the client area, because it is not written to any folder.
In Hosting, open your service, go to PHP and click Change on the Default version row. Bear in mind that the change affects every website without its own version, not just the one published with Deploy+. Before and after, we check that they respond, and you have 24 hours to roll back with one button. It is explained in Change a website's PHP version.
If the website already has its own version in its .htaccess, changing the default version does not move it: change it in the repository.
What still works from the client area
- PHP extensions and limits: they belong to each version across the whole account, not to a folder, so you change them from the website's page as for any other.
- Errors: the website's error log is available as usual.
Check the result
After deploying, the PHP section shows the new version as soon as it scans your websites again, which it does once a day. If you want to see it sooner, click Refresh in the service's Technical details.
More on how deployments work in Automatic deployment from GitHub, GitLab or Bitbucket with instant rollback.
You may also find useful
- Change PHP options with the selector or .htaccess Change supported PHP directives from the cPanel selector or, when the handler allows it, with php_va...
- Different PHP versions per directory or domain Assign a different PHP version to a website or any folder from the client area or with AddType in .h...
- Change a website's PHP version with checks and rollback Change a website's PHP version, or your hosting's default version, from the client area, with a comp...
- PHP, select version, modules and basic configuration Change the PHP version, enable or disable modules and adjust the most common limits from the client...
Something wrong or out of date? Tell us and we will review it.