centos install php fpm for php 7.1 code example

Example: install php 7.4 fpm

<?php
// Step 1: Setup PHP with Apache2 HTTP Server

sudo apt update
sudo apt install apache2

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

// Step 2: Install PHP 7.4 to Support Apache2

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

sudo apt update

sudo apt-get install php7.4 libapache2-mod-php7.4 php7.4-cli php7.4-mysql php7.4-gd php7.4-imagick php7.4-recode php7.4-tidy php7.4-xmlrpc

// Step 3: Configure PHP 7.4 for Apache2
  
sudo nano /etc/php/7.4/apache2/php.ini

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago
<IfModule mod_dir.c>
     DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

sudo systemctl restart apache2.service
?>

Tags:

Php Example