DebianDebian Based

How To Install Symfony PHP Framework on Debian 12

Install Symfony PHP Framework on Debian 12

In this tutorial, we will show you how to install Symfony PHP Framework on Debian 12. Symfony is a highly regarded PHP framework known for its flexibility, scalability, and rich set of features. It’s widely used by developers to build web applications, from simple websites to complex enterprise systems. Debian 12, on the other hand, is a rock-solid and reliable Linux distribution. Combining Symfony with Debian 12 gives you a secure and efficient platform to develop and deploy your web applications.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Symfony PHP Framework on a Debian 12 (Bookworm).

Prerequisites

  • A server running one of the following operating systems: Debian 12 (Bookworm).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • Make sure your Debian 12 system is connected to the internet. An active connection is essential for downloading the required packages and updates during the installation.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Symfony PHP Framework on Debian 12 Bookworm

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade

This command updates the package list and upgrades the installed packages to their latest versions.

Step 2. Installing Required Packages.

To successfully install Symfony Framework, you need to install essential packages. Run the following command to install the required packages:

sudo apt install php php-json php-ctype php-curl php-mbstring php-xml php-zip php-tokenizer php-tokenizer libpcre3 git zip unzip

Step 3. Installing Symfony PHP Framework on Debian 12.

To download the Symfony installer script, visit the official Symfony website. You can do this using your preferred web browser. The website is the primary source of Symfony-related resources, and it’s always a good idea to refer to official channels for the most reliable information:

curl -sS https://get.symfony.com/cli/installer | bash

Once Symfony is installed, you will get the following output below:

2023-10-12 10:46:24 (16.6 MB/s) - written to stdout [6300/6300]

Symfony CLI installer

Environment check
  [*] cURL is installed
  [*] Tar is installed
  [*] Git is installed
  [*] Your architecture (amd64) is supported

Next, it’s time to pinpoint the exact location of the Symfony system on your system. This can be achieved by executing the following command:

export PATH="$HOME/.symfony5/bin:$PATH"
source ~/.bashrc

Step 4. Create Symfony Project.

Now create a new Symfony project by running the following command in your terminal:

symfony new project --full

This command will create a new Symfony project with all the recommended packages and configurations.

Next, navigate to your project and run the web server using the following command:

cd project
symfony server:start

Output:

[OK] Web server listening                                                                                              
      The Web server is using PHP CLI 8.2                                                                             
      http://127.0.0.1:8000                                                                                             
                                                                                                                        

[Web Server ] Oct 21 11:15:46 |DEBUG  | PHP    Reloading PHP versions 
[Web Server ] Oct 21 11:15:66 |DEBUG  | PHP    Using PHP version 8.2 (from default version in $PATH)

Step 5. Accessing Symfony Web UI.

Open your web browser and go to http://localhost:8000. If everything is configured correctly, you should see the Symfony welcome page.

Install Symfony PHP Framework on Debian 12 Bookworm

Congratulations! You have successfully installed Symfony. Thanks for using this tutorial to install the latest version of Symfony PHP Framework on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official Symfony Framework website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button