Home > Operation and Maintenance > Linux Operation and Maintenance > How to install and configure PHP on Red Hat Enterprise Linux7.4

How to install and configure PHP on Red Hat Enterprise Linux7.4

WBOY
Release: 2023-05-23 12:08:41
forward
1532 people have browsed it

Step One: Install and Configure Apache Web Server
Before installing PHP, we need to verify that the Apache Web server is installed and running. The process of installing and configuring Apache web server on RHEL 7.4 is as follows.

  1. Use the root user to log in to the RHEL 7.4 server.

  2. Use the following yum command to update system packages:

yum update -y
Copy after login
  1. Install the Apache web server with root privileges:

yum install httpd -y
Copy after login
  1. After the installation is complete, use the following systemctl command to start the Apache web server and configure it to start at boot:

systemctl start httpd
systemctl enable httpd
Copy after login
  1. Access your server IP address in a web browser. If the Apache test page appears, the Apache server has been successfully installed and configured.

Step 2: Install PHP
Now that we have successfully installed and configured the Apache web server, let’s move on to installing and configuring PHP.

  1. Use the following commands to install PHP and related MySQL and Apache modules:

yum install php php-mysql php-gd -y
Copy after login
  1. After installation is complete, use the following Command to restart the web server for the changes to take effect:

systemctl restart httpd
Copy after login
  1. To verify that PHP is installed and configured correctly, create an index.php file:

vi /var/www/html/index.php
Copy after login
  1. Insert the following PHP code into the index.php file:


    <?phpphpinfo(); ?>
    
    Copy after login


  2. Save and exit the file, then enter your server IP address into your web browser and you should see the PHP information page. The PHP version, compilation options, and all loaded PHP modules will be listed on the page.

  3. The above is the detailed content of How to install and configure PHP on Red Hat Enterprise Linux7.4. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template