# Install & setup PHP 7.3 & Apache 2.4 on CentOS 8

In this post, I would focus on permission settings for website root folder of Apache. The rest of the other fairs are simpler than the permission settings, so that I wouldn’t describe too many details. However, you will finish these works if you follow this article step by step.

Step 1

### Install Apache and set it automatically start on boot.

Setup permission of firewall. Allow the HTTP and HTTPS  through firewall.

You could open your server by Chrome or any kind of browser software when you had finished the settings of the firewall. Your browser should be able to display the default website of Apache.

Step 2

### Install PHP 7.3

Because the default version of PHP’s repository on CentOS is 7.0, so you have to install a new repository which carries PHP 7.3. After then you could install PHP 7.3 and some relevant packages through dnf.

Step 3

### Permission of website root.

Finally, this is the most important part of this post.
I assumed the root path of your website is “/var/www”, and you have to run the commands under below:

The command in the line 2 and line 3 is to change the files’ owner and change the file type, respectively. Especially this file type is an attribute of SELinux in the line 3, and it’s also quite common for permission setting of Apache.

If your website is using the famous CMS, WordPress, then you could follow the recommendation for permission settings under below:

This example is based on the website root path was located at “/var/www”.

There is a file type called “httpd_sys_rw_content_t” which means that path was allowed apache to read and write files inside. Actually I would extremely recommend you permit Apache to read and write for the whole WordPress path, just like the command under below. The reason is this setting could allow your WordPress upgrade smoothly, otherwise, you may occur some permission problem while upgrading. Because

PHP-FPM

### PHP-FPM

this is a special part of this post. If you modified php.ini, then you have to restart this program “php-fpm”. Because, php-fpm controlled the server relevant parameters, for instance, the maximum memory size that PHP can allocate. To that end, you can restart it through the command under below:

#### Andy Wang

Non-stop learning and facing challenges.

### 3 thoughts on “Install & setup PHP 7.3 & Apache 2.4 on CentOS 8”

This site uses Akismet to reduce spam. Learn how your comment data is processed.