If you want to install the latest php with nginx and mariadb, this blog is the right writing for you
NGINX
Update and upgrade your OS.
sudo su yum update -y yum upgrade -y
Create the file named /etc/yum.repos.d/nginx.repo.
vi /etc/yum.repos.d/nginx.repo
Following contents:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/ gpgcheck=0 enabled=1
Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “6” or “7”, for 6.x or 7.x versions, respectively or read this URL for detail instruction http://nginx.org/en/linux_packages.html
After follow that instruction, update again your OS
yum update -y
Install nginx via command line
yum install nginx -y
Enable nginx if the system boots.
systemctl enable nginx
Start nginx service
systemctl start nginx
PHP 7.2.x
Update and upgrade your OS.
sudo su yum update -y yum upgrade -y
Turn on EPEL repo
yum install epel-release
Install remi repo
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Install yum utils
yum install yum-utils
Enable remi repo
yum-config-manager --enable remi-php72 yum update -y
Install PHP 7.2
yum install php
* make sure there is php version 7.2.x
Install PHP FastCGI Process Manager with commonly used modules
yum install php-fpm php-gd php-json php-mbstring php-mysqlnd php-xml php-xmlrpc php-opcache
Verification PHP was installed correctly
php --version php --modules
Enable systemctl for PHP
systemctl enable php-fpm.service
Start PHP service
systemctl start php-fpm.service
CONFIGURE NGINX FOR PHP
Find nginx user and group
egrep '^(user|group)' /etc/nginx/nginx.conf
Edit php-fpm configuration
vi /etc/php-fpm.d/www.conf
Set user and group to nginx
user = nginx group = nginx
Restart php-fpm service
systemctl restart php-fpm.service
Edit nginx configuration
vi /etc/nginx/conf.d/default.conf
Follow this config
location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
Restart nginx service
systemctl restart nginx
Create file test.php for verification installation was correctly
vi /usr/share/nginx/html/test.php
Follow this code for content test.php
<?php phpinfo(); ?>
Open URL for testing
http://your-ip-or-domain/test.php
Screenshhot if php and nginx was installed correctly
MARIA DB
Open this URL https://downloads.mariadb.org/mariadb/repositories/ for get repo configuration.
Write the repo config to file
vi /etc/yum.repos.d/MariaDB.repo
Update OS
yum update -y
Install MariaDB
yum install MariaDB-server MariaDB-client
Enable systemctl mariadb
systemctl enable mariadb
Run mariadb service
systemctl start mariadb
Install via command
mysql_secure_installation
Yeaaaaayyy,, you are finished all instruction… Thanks for following this instruction.