Apache installation on centos
8
To install
Apache on CentOS 8, you can use the `dnf` package manager, which is the
replacement for `yum` in CentOS 8. Here's a step-by-step guide to installing
Apache:
1. Open a
terminal on your CentOS 8 system.
2. Update
the package list to ensure you have the latest information about available
packages:
sudo dnf update
3.
Install Apache using the `dnf` package manager:
sudo dnf install
httpd
4. After
the installation is complete, start the Apache service:
sudo systemctl start
httpd
5. Enable
Apache to start on boot:
sudo systemctl
enable httpd
6. Check
the status of Apache to ensure it's running without any issues:
sudo systemctl
status httpd
7. Adjust
the firewall settings to allow incoming HTTP traffic:
sudo firewall-cmd
--add-service=http --permanent
sudo firewall-cmd
--reload
Now, Apache should be
installed and running on your CentOS 8 system. You can verify its functionality
by opening a web browser and accessing your server's IP address or domain name.
You should see the default Apache welcome page if everything is set up
correctly.
PHP installation on centos 8
To install PHP on CentOS
8, you can use the `dnf` package manager. Additionally, you may want to install
some commonly used PHP extensions to ensure the proper functioning of PHP-based
applications. Here's a step-by-step guide to installing PHP:
1. Open a
terminal on your CentOS 8 system.
2. Update
the package list to ensure you have the latest information about available
packages:
sudo dnf update
3.
Install PHP and some commonly used extensions:
sudo dnf install php
php-cli php-fpm php-mysqlnd php-pdo php-gd php-xml php-mbstring
The packages above include
the basic PHP package (`php`), command-line interface (`php-cli`), PHP-FPM
(FastCGI Process Manager) for serving PHP through a web server, MySQL support
(`php-mysqlnd`), PDO (PHP Data Objects) for database connectivity (`php-pdo`),
GD library for image manipulation (`php-gd`), XML support (`php-xml`), and
multibyte string support (`php-mbstring`).
4. After
the installation is complete, start and enable the PHP-FPM service:
sudo systemctl start
php-fpm
sudo systemctl
enable php-fpm
5. Check
the status of PHP-FPM to ensure it's running without any issues:
sudo systemctl
status php-fpm
6. Restart
Apache: After making any changes to the Apache or PHP-FPM configuration,
restart Apache to apply the changes:
sudo systemctl
restart httpd
Now, PHP is installed and
ready to be used on your CentOS 8 system. You can test your PHP installation by
creating a PHP file with the following content:
<?php
phpinfo();
?>
Save the file as
`info.php` in your web server's document root directory (typically
`/var/www/html/`):
sudo echo
"<?php phpinfo(); ?>" > /var/www/html/info.php
Then, open a web browser
and navigate to `http://your_server_ip/info.php` or
`http://your_domain/info.php`. You should see a PHP information page displaying
PHP version, configuration settings, and more. Remember to remove this
`info.php` file after testing for security reasons.