Part of my vacation time I like to spend learning and playing with tech. As I spend every waking moment of my professional day in the “frontend” space, I wanted to step back into the “backend” space and my roots of PHP and explore what’s new with PHP8 in particular. I have always been a huge fan of Symfony, so I wanted to start with the latest.

This documents my journey as a “noob” to a “Hello World!”

First, I wanted to install Ubuntu 20.04 LTS so I had a decent baseline. I live a double life as a PC gamer, so my main workstation is a Windows PC that now thankfully supports Windows Subsystem Linux; in my case WSL2.

Install Ubuntu 20.04

First, make sure you’re running WSL. Part of that includes selecting a distribution. If you’re in a situation like me where you’re running an older version (18.04 LTS in my case) and want to update to the latest, those steps are here:

sudo apt update
sudo apt list --upgradable
sudo apt upgrade
sudo apt --purge autoremove
sudo apt install update-manager-core
sudo do-release-upgrade

You may see an error message “You have not rebooted after installing a package” — if you do, open PowerShell as an Administrator and run the following: Restart-Service LxssManager

When completed, you should be able to see the following after running within your instance:

cat /etc/os-release

Install PHP8 (Ubuntu)

Installing PHP8 takes mere moments within your linux instance. Simple run these commands, or download as a simple bash script:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.0-common php8.0-cli -y
sudo apt install php8.0-{bz2,curl,intl,mysql,readline,xml}
sudo apt install php8.0-pcov # PCOV code coverage tool
sudo apt install php8.0-xdebug # Xdebug debugger

# for nginx
#sudo apt install php8.0-fpm

# for apache
#sudo apt install libapache2-mod-php8.0

# purge old versions of PHP if applicable
sudo apt purge '^php7.*'

One liner install:

wget -O - -q | bash

Install Composer 2


EXPECTED_CHECKSUM="$(wget -q -O -"
php -r "copy('', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

    >&2 echo 'ERROR: Invalid installer checksum'
    rm composer-setup.php
    exit 1

php composer-setup.php --quiet
rm composer-setup.php
exit $RESULT

One liner install:

wget -O - -q | php -- --quiet

Install Composer globally:

chmod +x composer.phar
mv composer.phar /usr/bin/composer

Setup Symfony app

I am an avid fan of Symfony as a framework because of its flexibility and dedication to performance and extensibility.

First, install the symfony CLI:

wget -O - | bash

Next, create your naked Symfony app:

symfony new my-app
symfony server:ca:install


symfony serve