Skip to content

Instantly share code, notes, and snippets.

@iamdylanngo
Last active March 24, 2020 15:35
Show Gist options
  • Select an option

  • Save iamdylanngo/e4a32c14b1bc3b119017e07f772bc28a to your computer and use it in GitHub Desktop.

Select an option

Save iamdylanngo/e4a32c14b1bc3b119017e07f772bc28a to your computer and use it in GitHub Desktop.
php7-centos-8.readme
sudo yum search php-
sudo yum module list php
sudo yum install yum-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo yum module list php
sudo yum module reset php
sudo yum module enable php:remi-7.4
## verify it php set to 7.4 ##
sudo yum module list php
sudo systemctl enable --now php-fpm
If SELinux is running on your system, you’ll need to update the SELinux security context:
sudo chcon -tR httpd_sys_rw_content_t /var/www
sudo systemctl restart httpd
sudo yum install php-fpm php-common php-cli php-mysqlnd php-zip php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
sudo systemctl restart php-fpm
Test
echo '<?php phpinfo();' | sudo tee /var/www/html/info.php
sudo systemctl restart httpd
# Check location of PHP-FPM FastCGI server
cat /etc/nginx/conf.d/php-fpm.conf
# Check unix sock is working
ls -l /run/php-fpm/www.sock
How to install additional php modules
sudo yum search php-
sudo yum search php- | grep mysql
sudo yum search php72- ## for version 7.2 ##
sudo yum search php73- ## for version 7.3 ###
sudo yum search php74- ## for version 7.4 ##
# Demo for wordpress
sudo yum install php-mysqlnd php-gd php-pecl-zip php-mbstring php-xml php-opcache php-pecl-imagick
How to configure PHP 7.x
You need to edit the following files as per your needs:
/etc/php.ini – PHP’s initialization and config file. Do not modify this file. Instead create custom.ini in /etc/php.d/ directory.
/etc/php-fpm.conf – Gloable FPM (FastCGI) configuration file.
/etc/php-fpm.d/www.conf – FastCGI (FPM) www pool config file.
/etc/php.d/ – PHP modules config file.
How to List Installed PHP Modules
# yum list installed | grep -i php #RHEL/CentOS
# dnf list installed | grep -i php #Fedora 22+
# dpkg --get-selections | grep -i php #Debian/Ubuntu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment