Installation PHP 7 in CentOS 7

Anonim

Installation PHP 7 in CentOS 7

PHP - Script programming language, which is installed by default along with the other standard components of the CentOS 7 operating system. However, updates for this platform are quite rare, so users are forced to work with the old PHP version 5. New PHP 7 assembly will be available only after independent download Suitable repository and further installation of all libraries. As part of today's article, we will try to describe this process as much as possible.

Install PHP 7 in CentOS 7

As the preferential majority of software in CentOS, PHP 7 is installed by entering the corresponding commands in the classical console. The user does not require knowledge of the principles of all algorithms, since it will only be necessary to enter the specified lines in the Terminal. We broke the entire procedure for steps to simplify the task for inexperienced users. Let's start with the first action.

Step 1: Adding Required Repository

All PHP 7 components are stored in two storage facilities, which are missing in the CENTOS 7 operating system. The user needs to add them yourself, making sure the availability of active Internet connection.

We want to draw the attention of those users who installed on their PHPMYAdmin. During this procedure, the repositories under consideration below are also added, so you can skip this step. Deployed Instructions for Installation PHPMYAdmin Search in another article on the following link, and we go to add libraries in the OS.

Read more: Installation PHPMYAdmin in CentOS 7

  1. Go to the "Terminal" in any convenient way, for example, running it through the icon in the menu.
  2. Transition to the terminal for Further Installation PHP 7 in CentOS 7

  3. Initially add the Extra Packages for Enterprise Linux repository by entering the sudo rpm -uvh command https://dl.fedoraproject.org/pub/epel/epel-release-terest-7.noarch.rpm and clicking on the ENTER key.
  4. Team to download PHP 7 repository for CENTOS 7 operating system

  5. Since the actions are performed on the name of the superuser, you will need to confirm the authentication of the account, specifying the password.
  6. Enter the password to add the first PHP 7 repository in CentOS 7

  7. Upon completion of the addition of new packages, you will install another repository - REMI - through the Sudo RPM line http://rpms.remirepo.net/enterprise/remi-release-7.rpm.
  8. Adding a second PHP 7 Request Repository in CentOS 7

When requests for confirmation of adding new files, always agree to this, choosing an answer version Y. In addition, we advise you to read the text displayed in the console to the console: sometimes it indicates the occurrence of certain errors. Timely detection and correction will help avoid problems in the future.

Step 2: Activation PHP 7

The creators of the REMI repository argue that it is necessary to add packets based on RPM to the system. This includes the scripted PHP programming language. After completing the first step in CentOS 7, several PHP versions should be available, therefore, it will be necessary to switch to the latest:

  1. Browse the list of available Remi repository via the standard LS command by entering Ls /etc/yum.repos.d/remi*. With the rest of the properties of the utility used, we propose to get acquainted in a separate material further.
  2. Team to view the installed PHP 7 repositories in CentOS 7

    We want to note that above we recommended a Nano text editor. By default, it is missing in the system, but added with just one Sudo Yum Install Nano command. In some cases, such a solution will be much more convenient to VI.

    Step 3: Install PHP 7

    Adding and activating all components is successfully completed, it remains only to compile directly the PHP 7 itself so that you can start working with this programming language. This is done in entering the console of the corresponding commands.

    1. If you have previously already installed the previous version of PHP, you will only have to update the system libraries via Sudo Yum Update.
    2. Updating system libraries for installation PHP 7 in CentOS 7

    3. When installing new packages, choose the Y option to confirm the action.
    4. Confirmation of adding new files for PHP 7 in CentOS 7

    5. If the computer has never been the installed PHP version, you will additionally need to enter the Sudo Yum Install PHP PHP-FPM PHP-GD PHP-MYSQL.
    6. Installing all PHP 7 components in the CENTOS 7 operating system

    7. Package installation should also be confirmed by specifying the correct option.
    8. Confirmation of installing all PHP 7 components in CentOS 7

    Checking the PHP version used is available at any time by entering the PHP00 -V or PHP00 -R command "phpinfo ();" | Grep "PHP Version", where 00 in both cases is a suitable version of PHP.

    This installation procedure has been successfully completed. Note that switching to the new version is a mandatory process. Additionally, you need to restart the used web servers, if any, but this does not concern Apache. For NGINX, enter Sudo SystemCTL Restart PHP-FPM.

Read more