So you are looking for a way to install PHP 7.4 on Kali Linux rolling release?. PHP is a very popular server-side scripting language used in development of Web applications and creation of dynamic web pages. PHP applications usually work with HTML and interact with relation database management systems. This is why PHP is part of the LAMP or LEMP stack – Apache/Nginx, MySQL and PHP running on a Linux machine.

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2020/02/echo/install-php-kali-linux.png" data-ez ezimgfmt="rs rscb8 src ng ngcb8 srcset" src="data:image/svg xml,”>

The GA release of PHP 7.4 was on November 28, 2019. Use the link to check all the new features of PHP 7.4. This setup has been done on Kali Linux 2020.x update. If you’re running Kali Linux 2019.x, check how you can upgrade from Kali Linux 2019.x to 2020.x.

Install PHP 7.4 on Kali Linux

Follow the steps below to install PHP 7.4 on Kali Linux distribution. The latest builds of PHP for Debian are available on SURY PHP PPA repository. We’ll add the repository as prerequisite then install PHP 7.4 on Kali Linux.

Step 1: Update system

Ensure your system is updated:

sudo apt update
sudo apt upgrade -y

Once the system is updated, proceed to add the SURY PHP repository.

Step 2: Add SURY PHP PPA repository

Import the GPG key and add the PPA repository.

sudo apt -y install lsb-release apt-transport-https ca-certificates 
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

Then add repository.

echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list

Step 3: Install PHP 7.4 on Kali Linux

The last step is to Install PHP 7.4 on Kali Linux. You’ll need to update the apt package index before installation.

sudo apt update

Then install  PHP 7.4 on Kali Linux.

sudo apt -y install php7.4

Confirm PHP version installed.

$ php -v
PHP 7.4.3 (cli) (built: Feb 20 2020 14:15:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

All additional PHP extensions can be installed with the command syntax:

sudo apt-get install php7.4-xxx

Example:

sudo apt-get install php7.4-{cli,json,imap,bcmath,bz2,intl,gd,mbstring,mysql,zip}

PHP configurations related to Apache is stored in /etc/php/7.4/apache2/php.ini

Using PHP with Nginx:

The installation of PHP on Kali Linux automatically configure Apache. If you want to use Nginx and PHP, you need to stop and disable Apache service.

sudo systemctl disable --now apache2

Then install fpm extension and nginx packages.

sudo apt-get install nginx php7.4-fpm

Then start and enable the services.

sudo systemctl enable --now php7.4-fpm nginx

PHP FPM configuration files are located in the directory: /etc/php/7.4/fpm/

The nginx and php-fpm services should be running.

$ systemctl status php7.4-fpm nginx
systemctl status php7.4-fpm nginx
● php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2020-02-22 09:48:42 EST; 13s ago
       Docs: man:php-fpm7.4(8)
   Main PID: 12645 (php-fpm7.4)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 2318)
     Memory: 15.2M
     CGroup: /system.slice/php7.4-fpm.service
             ├─12645 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
             ├─12646 php-fpm: pool www
             └─12647 php-fpm: pool www

● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2020-02-22 09:48:42 EST; 13s ago
       Docs: man:nginx(8)
   Main PID: 12650 (nginx)
      Tasks: 9 (limit: 2318)
     Memory: 12.3M
     CGroup: /system.slice/nginx.service
             ├─12650 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ├─12652 nginx: worker process
             ├─12653 nginx: worker process
             ├─12654 nginx: worker process
             ├─12655 nginx: worker process
             ├─12656 nginx: worker process
             ├─12657 nginx: worker process
             ├─12658 nginx: worker process
             └─12659 nginx: worker process

You can begin your PHP applications development on Kali Linux. If you have a different Linux distribution, check out other guides available.

Install PHP 7.4 on Debian.

How To Install PHP 7.4 on CentOS 8 / RHEL 8

How To Install PHP 7.4 on Ubuntu

How To Install PHP 7.4 on CentOS 7

How To Install PHP 7.4 on Fedora