# PHP

## The Basics

<details>

<summary>Install php</summary>

```bash
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php8.2 -y
```

</details>

<details>

<summary>Php libraries</summary>

```bash
sudo apt install php8.2-common
sudo apt install php8.2-cli
sudo apt install php8.2-fpm
sudo apt install php8.2-mysql
sudo apt install php8.2-memcache
sudo apt install php8.2-memcached -y
sudo apt install php8.2-bcmath
sudo apt install php8.2-curl
sudo apt install php8.2-mbstring -y
sudo apt install php8.2-gmp -y
sudo apt install php8.2-zip -y
sudo apt install php8.2-xml -y
sudo apt install php8.2-dev -y
sudo apt install php8.2-redis -y
sudo apt install php8.2-gd -y
sudo apt install php8.2-sqlite3
```

</details>

<details>

<summary>Change php version</summary>

```bash
sudo update-alternatives --config php
```

</details>

<details>

<summary>Turn on php error_log to file</summary>

```
cd /etc/php/8.2/cli && sudo nano /etc/php/8.2/cli/php.ini
```

```
error_log = /home/ubuntu/logs/php_errors.log
```

</details>

* `php -S localhost:8000`







## Digging Deeper
