1. Login via SSH and update the system software
To install PHP 7 on an CentOS VPS, you need to login to your server via SSH. Once you are logged in, update all your system software to the latest version using the command below:
yum update
2. Add the required repositories to yum
Once the update of your system is completed, you can go ahead and add the required repositories to yum.
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3. Install PHP 7
Now, install PHP 7 using the following command:
yum install php70w
4. Verify the PHP 7 installation
The installation should take a few moments. Once it is completed, you can ensure that the latest stable release of PHP 7 is installed on your system by using the command:
php -v
You should see something like this:
PHP 7.0.0 (cli) (built: Dec 2 2015 20:42:32) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
5. Search all available PHP 7 modules
If you like to search all the available PHP 7 modules you can use to command:
yum search php70w
6. Install specific PHP 7 module
To install specific PHP 7 modules like the module that allows PHP applications to use MySQL databases, you can use the command below:
yum install php70w-mysql
7. Test PHP 7 functionality
To test the functionality of PHP 7 on your CentOS VPS you can create a simple PHP info file and place it in your web server’s document root. Navigate to your web server’s document root:
cd /var/www/html/
Create a PHP info file using nano:
nano info.php
Paste the following content into that file:
<?php phpinfo(); ?>
Save the file and close it. Also, change the ownership of the file and make Apache the owner of that file:
chown apache: info.php
8. Restart Apache Server
Do not forget to restart your Apache web server if you haven’t restarted it yet so the installation changes can take effect:
systemctl restart httpd
The last thing is to access the file using a web browser. Open your favorite web browser and navigate to the following address:
http://111.111.111.111/info.php
No comments:
Post a Comment