Install php7.4 on Ubuntu/Linux

PHP is an open source server side programming language. It is used to create dynamic web or mobile web applications.

Install php7.4 on ubuntu or linux

To install php on linux or ubuntu operating system open your terminal window and follow the commands shown below:

# add respository for php
sudo add-apt-repository ppa:ondrej/php

# update your local cache
sudo apt-get update

# install php7.4
sudo apt install php7.4 

# install common php dependencies
sudo apt install php7.4-gd php7.4-cli php7.4-fpm php7.4-json php7.4-xml php7.4-zip php7.4-mysql php7.4-mbstring php7.4-curl

Install memcached with php

If you want to install memcached also along with your php version open your terminal and follow the commands shown below:

# install memcached first
sudo apt-get install memcached

# install php library for memcached
sudo apt install php7.4-memcached

To check memcached settings run following command:

echo "stats settings" | nc localhost 11211

Above commad will show following output:

STAT maxbytes 134217728
STAT maxconns 1024
STAT tcpport 11211
STAT udpport 11211
STAT inter
STAT verbosity 0
STAT oldest 0
STAT evictions on
STAT domain_socket NULL
STAT umask 700
STAT growth_factor 1.25
STAT chunk_size 48
STAT num_threads 4
STAT num_threads_per_udp 4
STAT stat_key_prefix :
STAT detail_enabled no
STAT reqs_per_event 20
STAT cas_enabled yes
STAT tcp_backlog 1024
STAT binding_protocol auto-negotiate
STAT auth_enabled_sasl no
STAT item_size_max 1048576
STAT maxconns_fast no
STAT hashpower_init 0
STAT slab_reassign no
STAT slab_automove 0
STAT lru_crawler no
STAT lru_crawler_sleep 100
STAT lru_crawler_tocrawl 0
STAT tail_repair_time 0
STAT flush_enabled yes
STAT hash_algorithm jenkins
STAT lru_maintainer_thread no
STAT hot_lru_pct 32
STAT warm_lru_pct 32
STAT expirezero_does_not_evict no

That's it you have latest php installed on your linux based operating system.