These step-by-step instructions will help you setup the environment in a way you can easily develop and test an application with PHP and MariaDB on your workstation.
Let's assume we want to use the following directory as the root directory for our project:
Ensure that everyone - or at least Apache -has permissions to access that directory. Do the same for all directories in it's path.
chmod a+rx /home/twillber/www/project1
Since we are operating in your home directory SELinux should have no issues with this. If you decide to go outside of your own home directory you'll probably need to set the correct context to the www directory.
First we'll install the required packages for PHP and MariaDB (replacement of MySQL).
yum install httpd php mariadb-server php-pear-MDB2-Driver-mysqli
systemctl enable httpd
systemctl enable mariadb
systemctl start mariadb
Create file /etc/httpd/conf.d/mylocal.conf with the following content:
< Directory "/securehome/twillber/www">
DirectoryIndex index.php index.htmlOptions +Indexes +FollowSymLinks +MultiViews
Require all granted
Alias /project1 /home/twillber/www/project1/
Alias /project2 /home/twillber/www/project2/
Ready to go
At this point you probably want to create some kind of index.php into your working directory. Maybe even use mysqli API to connect to MariaDB, write some HTML and CSS and make the next killer app!
But first, restart Apache:
systemctl restart httpd
Then use your favorite browser and see the magic: