PHP 7.4 ON UBUNTU SERVER 20.04
PHP is a server-side scripting language that is used to develop Static websites or Dynamic websites or Web applications. PHP stands for Hypertext Pre-processor, which earlier stood for Personal Home Pages. PHP scripts can only be interpreted on a server that has PHP installed. The client computers accessing the PHP scripts require a web browser only. Source: https://www.guru99.com/what-is-php-first-php-program.html
root@snet[~]# sudo apt-get install software-properties-common
root@snet[~]# sudo add-apt-repository ppa:ondrej/php
root@snet[~]# sudo apt-get update -y
root@snet[~]# apt-get -y install php7.4 libapache2-mod-php7.4 php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-gd php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-pspell php7.4-readline php7.4-soap php7.4-xml php7.4-zip php7.4-xmlrpc php-imagick php7.4-bcmath php-dompdf php-fpm php-mysql php7.4-memcache php7.4-memcached php7.4-stomp php7.4-xdebug php7.4-gearman php7.4-odbc php7.4-tidy php7.4-xsl php7.4-enchant php7.4-geoip php7.4-gnupg php7.4-interbase php7.4-mongo php7.4-pinba php7.4-ps php7.4-sybase php7.4-embed php7.4-dba php7.4-phpdbg php7.4-fpm libsmbclient php7.4-redis php7.4-pgsql ffmpeg php7.4-bz2
root@snet[~]# apt-get -y install build-essential apache2 php7.4 openssl perl make php7.4-gd libgd-dev libapache2-mod-php7.4 libperl-dev libssl-dev daemon wget apache2-utils unzip php-net-ldap3 php-net-idna2
root@snet[~]# apt-get install -y php-apcu php-apcu-bc
root@snet[~]# sudo a2enmod rewrite headers env dir mime
root@snet[~]# sudo service apache2 restart
root@snet[~]# sudo service php7.4-fpm restart
root@snet[~]# sudo nano /etc/php/7.4/apache2/php.ini
After making the change below, save the file and close out.
post_max_size = 1000M
max_input_time = 5000
memory_limit = 1000M
upload_max_filesize = 1000M
max_execution_time = 5000
date.timezone= "Africa/Accra"
Uncomment the folloing , save the file and close out.
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
CONFIGURE APACHE2 AND PHP-FPM
root@snet[~]# sudo a2dismod php7.4 mpm_prefork
root@snet[~]# sudo a2enmod proxy_fcgi setenvif mpm_event rewrite headers env dir mime ssl http2
root@snet[~]# sudo a2enconf php7.4-fpm
root@snet[~]# sudo nano /etc/php/7.4/fpm/php.ini
After making the change below, save the file and close out.
post_max_size = 1000M
max_input_time = 5000
memory_limit = 1000M
upload_max_filesize = 1000M
max_execution_time = 5000
date.timezone= "Africa/Accra"
Uncomment the folloing , save the file and close out.
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
root@snet[~]# sudo systemctl restart apache2
root@snet[~]# sudo systemctl restart php7.4-fpm