Table of Contents
What you will read?
Symfony is a powerful PHP framework for building high-performance and enterprise-grade web applications. It’s known for its stability, modular structure, and scalability. Installing Symfony on CentOS Stream 9 gives developers a reliable and secure environment for modern PHP development.
Update the System
Before installing anything, update your CentOS Stream 9 system to ensure you have the latest security patches and package updates:
sudo dnf update -y
Install PHP and Required Extensions
Symfony requires PHP 8.2 or higher. You can install it using the AppStream or Remi repository.
First, enable the Remi repository for newer PHP versions:
sudo dnf install -y dnf-utils
sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.2 -y
Then install PHP with all required extensions:
sudo dnf install -y php php-cli php-common php-mbstring php-xml php-zip php-curl php-intl php-sqlite3 unzip git
Verify PHP installation:
php -v
You should see output like:PHP 8.2.x (cli) (built: ...)
Install Composer
Symfony uses Composer, the PHP dependency manager, to handle packages and libraries.
Run these commands to install it globally:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
php -r "unlink('composer-setup.php');"
Check Composer’s version:
composer --version
Install Symfony CLI
Symfony offers a CLI tool that simplifies project creation and management.
Download and install it:
wget https://get.symfony.com/cli/installer -O - | bash
Move it to a global location so you can run it from anywhere:
sudo mv ~/.symfony*/bin/symfony /usr/local/bin/symfony
Check if the Symfony CLI is working:
symfony -v
Create a New Symfony Project
Now that all dependencies are ready, create a new Symfony project:
symfony new my_project --webapp
This command installs Symfony with all standard components (Twig, Doctrine, etc.) and sets up the directory structure automatically.
Move into the project directory:
cd my_project
Run Symfony’s Local Web Server
You can start Symfony’s built-in local server with:
symfony serve
If successful, you’ll see something like:
[OK] Web server listening on https://127.0.0.1:8000
Now, open your browser and go to:
👉 https://127.0.0.1:8000
You’ll see the Symfony Welcome Page, confirming your installation is successful.
Fix Permissions (Optional)
If you encounter issues with cache or logs, adjust the file permissions:
sudo chown -R $USER:$USER ~/my_project
Deploy Symfony (Optional)
To serve Symfony on the web, you can configure Apache or Nginx.
For Apache:
sudo dnf install -y httpd php php-cli php-mbstring php-xml php-json
sudo systemctl enable httpd
sudo systemctl start httpd
Place your Symfony project in /var/www/html/ and configure a virtual host accordingly.
Installing Symfony on CentOS Stream 9 gives you a modern, secure, and flexible PHP development environment. With Symfony’s modular structure and CentOS’s enterprise-grade stability, this setup is ideal for both developers and production environments.
For fast CentOS VPS hosting optimized for Symfony, Laravel, and PHP projects, check out DropVPS — powerful, reliable servers built for developers.
