How one can Set up PHP 7.three on CentOS 7

On this tutorial, we’ll information you thru the steps of putting in the newest PHP model 7.three on a CentOS 7 VPS.

PHP is a server-side scripting language, generally used for Internet improvement, however it’s also used as a general-purpose programming language. It’s the most well-liked server-side (back-end) programming language and it powers among the hottest merchandise in the marketplace, comparable to WordPress, essentially the most broadly used content material administration system, in addition to e-commerce platforms comparable to Magento and PrestaShop. PHP additionally powers buyer relationship administration software program, enterprise useful resource planning software program, and plenty extra. The method of putting in PHP 7.three on CentOS 7 is a reasonably straightforward and easy activity, and it may be carried out in lower than 10 minutes.

PHP 7 gives a lot better performances and safety enhancements than its predecessors. Listed under are among the new options and adjustments in PHP 7.three:

  • Versatile Heredoc And Nowdoc Syntaxes
  • Enable a Trailing Comma in Operate Calls
  • JSON_THROW_ON_ERROR
  • Similar Website Cookie
  • Deprecate and Take away Case-Insensitive Constants
  • record() Reference Task
  • is_countable Operate
  • array_key_first(), array_key_last()
  • Argon2 Password Hash Enhancements

Stipulations

  • CentOS 7 VPS
  • Consumer with root privileges – All of our VPS internet hosting plans include full root entry. You can too use a person account with sudo privileges.

Step 1: Log in and Replace the Server

Login to your CentOS 7 VPS by way of SSH as the basis person:

ssh [email protected]IP_Address -p Port_number

Substitute ‘IP_Address‘ and ‘Port_number‘ along with your precise IP deal with and SSH port quantity.

Step 2: Set up PHP 7.three

CentOS 7 by default is shipped with PHP 5.four on the time of writing this text, which is a really outdated and outdated model and it has reached its finish of life in September 2015. This additionally provides safety vulnerabilities onto your server in case you use PHP in an online setting. Fortunately, some trusted and well-maintained repositories provide newer variations of PHP. On this case we’ll set up and use PHP 7.three from the Remi repository.

To begin with, test if PHP is already put in in your server. Whether it is put in, test what model your server is operating. You are able to do it with the next command:

# php -v

Output:

PHP 5.four.16 (cli) (constructed: Apr 12 2018 19:02:01)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.four.Zero, Copyright (c) 1998-2013 Zend Applied sciences

In keeping with the output, PHP 5.four is put in on our CentOS VPS, which we talked about that it’s the newest obtainable model within the CentOS 7 repositories. With a purpose to set up PHP 7.three, we’ve to take away this model:

yum take away php*

Eradicating:
 php       
 php-cli   
 php-common
 php-mysql 
 php-pdo

This command will take away PHP and all put in PHP extensions.

Run the next instructions so as to add the Remi and Epel repositories to your server, and set up yum-utils, which is a set of instruments for managing yum repositories:

yum set up http://rpms.remirepo.internet/enterprise/remi-release-7.rpm
yum set up yum-utils epel-release

Disable the PHP 5.four repository, which is enabled by default:

yum-config-manager --disable remi-php54

and allow the PHP 7.three repository:

yum-config-manager --enable remi-php73

After the Remi repository for PHP 7.three is enabled, we will simply set up it with the yum package deal supervisor.

yum -y set up php

Putting in:
 php                         
Putting in for dependencies:
 libargon2                   
 php-cli                     
 php-common                  
 php-json

It should set up PHP 7.three and a few of its dependencies, as proven within the output above.

As soon as the set up is accomplished, you possibly can test the put in PHP model:

php -v

Output:
PHP 7.three.0RC5 (cli) (constructed: Nov  6 2018 10:22:47) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.three.Zero-dev, Copyright (c) 1998-2018 Zend Applied sciences

You’ll be able to simply set up all mandatory PHP extensions utilizing the identical manner, so long as they’re obtainable within the repository. For instance, in case you want the MySQL, Multibyte String (mbstring), Mcrypt and the SimpleXML Parser PHP extensoins, you possibly can set up them with the next command:

yum -y set up php-mysqlnd php-mbstring php-pecl-mcrypt php-xml

You’ll be able to take a look at if the extensions is correctly put in utilizing the next command:

php -m |grep extension_name

For instance, to check if the Multibyte String (mbstring) extension is put in, you should utilize the next:

php -m |grep mbstring

output:

mbstring

Step three: Create a phpinfo Web page

With a purpose to test an in depth details about the put in PHP model, extension, settings, and far more, you possibly can create a phpinfo web page. It shows an enormous quantity of helpful details about PHP. Together with details about the PHP model, PHP compilation choices and extensions, server data and setting (if compiled as a module), the PHP setting, OS model data, paths, grasp and native values of configuration choices, HTTP headers, and the PHP License.

To do that, go to the net server’s doc root listing

cd /var/www/html

and create a phpinfo.php file with the next content material

vi phpinfo.php

Save the file and entry http://YourIPaddress/phpinfo.php along with your favourite internet browser. It is best to get the next web page

For extra details about PHP, its configuration and options you possibly can test their official documentation.


After all, you don’t have to put in PHP 7.three on CentOS 7 in case you use considered one of our PHP 7 VPS Internet hosting companies, during which case you possibly can merely ask our knowledgeable Linux admins to put in the newest model of PHP on CentOS 7 for you. They’re obtainable 24×7 and can deal with your request instantly.

PS. When you favored this put up on learn how to set up PHP 7.three on CentOS 7, please share it with your folks on the social networks utilizing the sharing buttons, or just go away a reply under. Thanks.

 

NTH Secure

A gamer myself, A Open Source hobbyists, A IT Security professional, A WordPress Blogger. I fully understand privacy and boosted speeds are what those who take online hosting seriously seek. Fast, secure and reliable, I've found that a VPS and Web hosting is common nowadays. Bringing extensive IT experience to the table, I enjoy helping others fine-tune their hosting services by sharing industry tips, high tech tricks and useful advice here on my website. Check back often to learn new skills of the trade, including how to perform a VPS and Web hosting setup from start to finish. Ready to level up your skill with NTHsecure? Forego the wait … it’s time to crate!

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.