One of the most widely used PHP frameworks, Symfony, makes it simple and quick to create your own applications. With a large developer community and a variety of decoupled and reusable components, Symfony has drawn a lot of interest from the open-source community.
I’ll walk you through the process of installing and configuring Symfony 3.0.0 for AKLWEB HOST LEMP VPS application development in this post.
The officially recommended method to install Symfony is to use the Symfony installer.
Log in from an SSH terminal, input:
sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony
Now you can use the symfony
command from your shell.
Create a new application with Symfony:
symfony new my_project
This command will create a directory called my_project
in your home directory to host all of your application files.
If you want to specify the version of Symfony, append the version number to the command mentioned above, like:
symfony new my_project 2.6
symfony new my_project 2.6.5
symfony new my_project 2.7.0-RC1
symfony new my_project lts
Execute the following commands to start the Symfony application:
cd my_project/
php bin/console server:run
If the operation was successful, you will see the prompt [OK] Server running on http://127.0.0.1:8000
appear on your screen. You can verify the result by accessing the URL http://127.0.0.1:8000/
from a web browser.
Keep the command running in the current SSH terminal. Open another SSH terminal and download a text browser called Lynx:
sudo yum install -y lynx
Visit http://127.0.0.1:8000/
from Lynx:
lynx http://127.0.0.1:8000/
You will see the welcome page of Symfony: “Welcome to Symfony 3.0.0”. Then press Shift + Q to quit Lynx.
If by any chance you see a blank page or an error page instead of the welcome page, you can try to fix the problem by reconfiguring the permissions on the ~/my_project/var/cache
and ~/my_project/var/logs
directories. Visit the Symfony website for more details.
You can also use a server configuration tester to check if your environment is ready for using Symfony. Access the following URL while your Symfony application is running:
lynx http://localhost:8000/config.php
In the Vultr LNMP environment, the server configuration tester will recommend us to install and enable the intl extension (used for validators) for a better Symfony experience. Here is the solution:
php -v
yum list php*intl sudo yum install php55u-intl.x86_64
sudo reboot
Congratulations! You have setup a Symfony application.