Change your website’s PHP version

Change your website’s PHP version


Hi there, this is Andrew from 20i and today
we’ll be going through the process of amending the version of PHP running on a
20i hosting package. Knowing how to amend the version of PHP running on a
package can be useful, if for example let’s say you have a WordPress website
that has a particular plugin that will only work under a certain version of PHP.
so perhaps this plug-in may only work under PHP 5.6 and you need to update
your package as required. There are a few ways to do this and we’ll go through
them in turn throughout the course of this video. The easiest way of going
about this is to use our tool available within the hosting package control panel
and we’ll show you we’ll show you how to use that now. So in order to do so we’ll
want to manage the package in question that we wish to do this on so we’ll
select ‘Manage Hosting’ and then we’ll select the package in question. So we’ll
just select ‘Manage’. Once we’ve done that we’ll then want to scroll down ever so
slightly I will want to select ‘Change PHP Version’. On this page we can see the
PHP version that we’re currently running and then if we select the drop down we
can see the versions of PHP here. It should be noted that on the WordPress
platform you can only select PHP version 7 and above. On the Linux
platform you can select all the PHP versions that we have available so 5.3
all the way to 7.3. So at the minute we can see that I’m running 5.6 on this package
so let’s say I want to change to PHP 7.0. What I do here I select PHP 7.0 from the
drop-down and then I simply select ‘Change PHP Version’. Once I do that in the
top right hand corner as you can see it says we’ve successfully updated the
version of PHP. Essentially, what this whole process is is that it will update
.htaccess in the root of the package with the required PHP version – the PHP version that we’ve set. So we can see this if we now go
to the hosting control panel and we then go to ‘File Manager’ and then once File
Manager has loaded and then we open up the .htaccess that’s in the root of the
package we can see here that the version of PHP has been set to seven and we can
also see this if we manually create a PHP info file. So as you can see here
what we’ll do, we’ll ‘New File’… will call this phpinfo.php And as we can see here we’ll just
manually create a ‘phpinfo’ file. And now if we visit the site – so if we go
to 20isupport.com/phpinfo.php we can see that I’m indeed running
PHP 7. So we can test this so if we now select 5.6 and then change PHP
version and then if we refresh our PHP info page we can see that I am indeed
running 5.6. So that’s how you use our tool in order to change the version of
PHP. You can also amend the version of PHP manually yourself. So for example
this might be useful if you need to set the version of PHP for a particular
subdirectory. So here the method that we’ve shown would change the version of
PHP for all sub directories. However, you might not necessarily want that or need
that and you might need to set the PHP version for a specific directory. So to
do this we basically just need to create a .htaccess in the directory in question.
So, for example, let’s say I create a new directory and I call this PHP70. So I want the entire site except this directory to run PHP 5.6 and
I want this directory just to use PHP 7.0. So to do this what we need to do is go
to the .htaccess that was amended earlier as a result of the WordPress
tool. I just want to copy this – we don’t necessarily need to copy these because
they’re just comments but we can do so anyway. We then just want to go to our
subdirectory that we just want to amend version of PHP for. So in the
subdirectory folder we want to create a htaccess. So .htaccess and in here we
want to set the version of PHP manually. So all we need to do is remove the
numbers that we don’t want and add the numbers that we do. So as you can see
here I’m setting PHP 7.0 in this particular subdirectory. So that’s now
saved we’ll close and again we’ll just create a PHP info so we can check the
actual version so again: phpinfo.php and we’ll just create. Let’s go ahead
and create that. OK, that’s now saved. So if we now
browse to: php70/phpinfo.php we can see that the version for
this particular subdirectory is indeed the one that we’ve manually set. So now
if we just go back to the site – not that particular subdirectory – so that’s 20isupport.com/phpinfo.php we can see that it’s set to 5.6. So the
rest of the site is 5.6 and just our particular subdirectory that we
played around with there as PHP 7.0. So that’s essentially how you change the
version of PHP on a package as we’ve shown you can do so via our tool or if
you wish to do so you can do so manually with a .htaccess. We hope this has helped
you run in to any problems let us know we’ll be more than happy to help. 🙂

Daniel Ostrander

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *