How to install Symfony PHP framework on Ubuntu 18.04?

0
211
Programming
Programming

On other occasions, we have talked about various PHP frameworks. For example, I taught you how to install Cake and Yii, but today I’ll teach you how to install Symfony which is perhaps one of the most robust.

Symfony PHP is a high-performance framework for developing web applications. So, it is very popular among groups of developers working on medium to large scale projects. In addition, it is one of the best-documented frameworks, with many books that teach you how to use its full potential.

So, let’s install Symfony on Ubuntu 18.04.

1. Install Apache web server

The first step is to install a web server, in this case, I will use Apache because it is easy to install and use.

1.- Install apache web server
1.- Install an Apache web server

Then, start and enable the service.

2.- Enabling Apache
2.- Enabling Apache

And that’s it.

2. Install PHP

Since it is a PHP framework it is obvious that you have to install the PHP language. So let’s go for it.

3.- Install PHP
3.- Install PHP

Now, restart apache.

3. Install MariaDB

If you are going to develop with a framework, it is necessary to have a database manager, so install MariaDB.

4.- Install MariaDB
4.- Install MariaDB

Then, enable and start the service.

5.- Enabling MariaDB service
5.- Enabling MariaDB service

Now, set a root password for MariaDB. You can do it using the mysql_secure_installtion script.

6.- Setting a root password for MariaDB
6.- Setting a root password for MariaDB

There you can configure other options, however, I leave it to your discretion the answers as for this tutorial are not decisive.

4. Install Symfony PHP

To install Symfony 4, you must first install Composer. Composer is a dependency manager for PHP.

10.- Composer installed
10.- Composer installed

As you can see, after an initial connection error, composer is installed properly.

Next, make Composer a global command.

11.- Setting Composer globally
11.- Setting Composer globally

5. Create a new project

Now it’s time to create a new Symfony project. It’s very simple.

12.- Install Symfony
12.- Install Symfony

Obviously, put the name of the project you want.

13.- Symfony installed
13.- Symfony installed

Then, serve the project.

14.- Symfony running
14.- Symfony running

Finally, open the web browser an go to http://IP_SERVER:8000. Or you can specify the IP and the port. It is useful if you are using a VM.

16.- Symfony running on a specific IP
16.- Symfony running on a specific IP
15.- Symfony is alive!
15.- Symfony is alive!

And that’s it.

Conclusion

While it is true that Symfony is a framework not so easy to learn, its installation on Ubuntu 18.04 is quite simple. All that’s left is for you to develop brilliant applications with it.

Please share this post with your friends.

Spread the love
  • 9
    Shares

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.

LEAVE A REPLY

Please enter your comment!
Please enter your name here