How to add custom PHP version to your VPS/Dedicated Server

As you may know the ntPHPselector in your VPS/DS’ cPanel comes with predefined php v5.3.x, v5.4.x and v5.5.x and if you wish to change the predefined php version to a custom one, you can do the following:

  • The first step is to log in as a root user to your VPS/DS machine
  • The ntPHPselector keeps the php binary files in the following location /opt/ntphp/
  • You will see there 3 folders: php53, php54, php55
  • Let’s say we want to change the default php v5.5.16 to php v5.5.20
  • Rename the php55 folder by executing the following command:

mv /opt/ntphp/php55 /opt/ntphp/php55_old

cPanel Hosting from WebhostFace
  • The next step is to upload on the server the desired custom PHP version from their official website
  • Let’s say the download file is in ~/php-5.5.20.tar.gz, extract it using: tar zxf php-5.5.20.tar.gz
  • Afterwards, navigate to the extracted folder: cd ~/php-5.5.20
  • Execute the following command:
    • ./configure –prefix=/opt/ntphp/php55
    • make
    • make install
  • This will install the uploaded custom PHP version in the specified folder
  • Now proceed to your cPanel -> ntPHPselector and change the PHP version to 5.5. *(this will vary depending on the version you have modified)
  • That is it, you should have the custom PHP version running on your VPS/DS

You can verify which PHP version you are running with by creating a phpinfo file.

was this knowledge base article useful to you