Skip to main content

php


FeatureTool
Languagephp
MVC FrameWorkLaravel
Codeigniter
Symphony
Other Web FrameworkFastAPI
flask
ORM
DB Access Library
IDEphpstorm
Serverapache2
Package Managercomposer
Related Other ToolsXampp
phpmyadmin
Artifactory Repository
Test
Queue
Tutorial

How to install php in ubuntu?

Note: for development environment, it's better to install xampp

sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https 
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.4 ### Or other php version php8.1 | php7.2 | php5.6
### Install necessary Extensions
sudo apt install php7.4-mysql php7.4-mbstring php7.4-xml php7.4-curl php7.4-cgi

How to install php 8.2 on ubuntu ?

sudo dpkg -l | grep php | tee packages.txt
sudo add-apt-repository ppa:ondrej/php # Press enter when prompted.
sudo apt update
sudo apt install php8.2 php8.2-cli php8.2-{bz2,curl,mbstring,intl}

sudo apt install php8.2-fpm
# OR
# sudo apt install libapache2-mod-php8.2

sudo a2enconf php8.2-fpm

# When upgrading from older PHP version:
sudo a2disconf php8.1-fpm

## Remove old packages
sudo apt purge php8.1*

Ref: https://php.watch/articles/install-php82-ubuntu-debian

Error Fatal error: Call to undefined function mysqli_connect()

sudo apt install php-mysqli

Some cool features of php

Dockerization of php application

FROM php:7.4-apache
RUN docker-php-source extract && docker-php-ext-install mysqli && docker-php-source delete
COPY --chown=www-data:www-data htdocs /var/www/html

Ref: https://hub.docker.com/_/php

How to install php 7.4 in ubuntu

Ref: https://vitux.com/how-to-install-php-72-73-74-on-ubuntu-22-04/ https://www.digitalocean.com/community/tutorials/how-to-install-php-7-4-and-set-up-a-local-development-environment-on-ubuntu-20-04

composer

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-20-04

How to install php7