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 full-stack PHP framework that follows the Model-View-Controller (MVC) architectural pattern, promoting code reusability, maintainability, and scalability. It offers a wide range of features, including routing, database integration, form handling, security, and caching, making it an excellent choice for building complex web applications. By leveraging Symfony’s robust ecosystem and adhering to its best practices, developers can streamline their workflow and deliver high-quality, secure, and maintainable 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 an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button