Install Symfony PHP Framework on Debian 12

In this guide, we want to teach you to Install Symfony PHP Framework on Debian 12 Bookworm. Symfony is a free PHP web application framework. It is used to speed up the creation and maintenance of web applications and replace repetitive coding tasks.

You can follow this guide from the Debian 12 Tutorials to complete your Symfony PHP Framework setup.

How To Install Symfony PHP Framework on Debian 12?

To complete this guide, you must have access to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow this guide on Initial Server Setup with Debian 12 Bookworm.

Step 1 – Install PHP and Extensions on Debian 12

As we mentioned, Symfony is a PHP web application framework. So you need to install PHP 7.2 or higher and its required packages on Debian 12. Debian 12 ships with PHP 8.2 by default.

First, update your local package index with the following command:

sudo apt update

Then, install PHP and the required packages with the command below:

sudo apt install php php-json php-ctype php-curl php-mbstring php-xml php-zip php-tokenizer php-tokenizer libpcre3 --no-install-recommends

Also, you need to install GIT, Zip, and Unzip on your server with the command below:

sudo apt install git zip unzip -y

Step 2 – Download Symfony CLI Installer Script on Debian 12

Now you can use the wget command to download and install Symfony CLI on Debian 12:

wget https://get.symfony.com/cli/installer -O - | sudo bash
Output
The Symfony CLI was installed successfully!

At this point, you need to add the Symfony installation path to the PATH user using the following command:

sudo export PATH="$HOME/.symfony/bin:$PATH".

Now you can apply the changes by running the following command:

source ~/.bashrc

Step 3 – Configure Git for Symfony PHP Framework

At this point, you can use the following commands to configure your email and username in Git:

# sudo git config --global user.email "Your_Email_Address"
# sudo git config --global user.name "Your_User_Name"

Step 4 – Test Symfony PHP Framework

Now you can create a new project to test your Symfony PHP framework:

symfony new example --full

When you are done, switch to your project directory:

cd example

Start the local webserver with the Symfony command on Debian 12:

symfony server:start
Output
[OK] Web server listening
The Web server is using PHP CLI 8.2.7
http://127.0.0.1:8000

Finally, you can check your Symfony project by going to the following address:

http://your-server-ip:8000/

You will see the Symfony welcome screen.

To exit from the Symfony PHP framework, you can press Ctrl + C.

For more information, you can visit theĀ Symfony Documentation page.

Conclusion

Symfony is aimed at building robust applications in an enterprise context and aims to give developers full control over the configuration. At this point, you have learned to Install Symfony PHP Framework on Debian 12 Bookworm.

Hope you enjoy using it.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular