• +1 3033561099
  • support@arosscloud.com

Install Apache and PHP on CentOS 7

2024-03-07 07:56:13

Install Apache

Use the following steps to install Apache:

  1. Run the following command:

    yum install httpd
  2. Use the systemd systemctl tool to start the Apache service:

    systemctl start httpd
  3. Enable the service to start automatically on boot:

    systemctl enable httpd.service
  4. Open up port 80 for web traffic:

    firewall-cmd --add-service=http --permanent
  5. Reload the firewall:

    firewall-cmd --reload

Confirm successful installation by entering your server's IP address in a browser to view the default Apache test page.

Install PHP 7.3

Use yum to install a repository that supports PHP 7.3:

  1. Run the following command:

    sudo yum install https://repo.ius.io/ius-release-el7.rpm
  2. Install PHP and some popular PHP modules:

    yum install mod_php73 php73-bcmath php73-cli php73-gd php73-ldap php73-mbstring php73-mysqlnd php73-soap
  3. Confirm your server is using PHP 7.3 by running the following command:

    php -v

You should see the following output:

    PHP 7.3.25 (cli) (built: Dec 1 2020 21:50:13) ( NTS )