Symfony is a very popular MVC framework for banking and ecommerce applications. In order to extract maximum performance from the framework, it is essential that the applications should be deployed on cloud hosting solutions. In many cases, developers often miss out on this performance hack and opt for shared hosting solutions that do not provide the optimal platform for Symfony applications. Thus, an important challenge is the process of Symfony migration from traditional hosting solutions to managed cloud hosting solutions.
Symfony gives all the required tools to utilize databases in your applications, including the likes of Doctrine library, the best set of PHP libraries to work with databases. Database migrations are a way to securely overhaul your database pattern, both locally and on production. Rather than running the doctrine:schema:update command, or applying the database changes manually with SQL statements, database migrations allow you to duplicate your database’s changes in a secure way.
In this tutorial, I will explain how you could migrate Symfony sites from cPanel-powered shared hosting to managed cloud hosting offered by Cloudways. Also, see cPanel alternatives here. Migrating Symfony to a different host is easy enough. The process of migrating Symfony Websites to Cloudways starts with signing up for an account on Cloudways. Next, follow these steps to help migrate your Symfony website.
How to Install Drupal 9 on Cloudways
Step 1: Backup the Symfony Website
Login to the cPanel hosting account.
Next, create a zip archive of all the files inside the Symfony folder.
Once the compression process finishes, login to the database manager (PHPMyAdmin in many cases) and export the database(s) to the local system.
You might also like: How to Install PHPMyAdmin
Add the database to the folder that contains the Symfony zip archive. This way, all relevant data could be downloaded imported to Cloudways through SSH terminal.
You are now done with your old hosting.
Nothing as Easy as Deploying PHP Apps on Cloud
With Cloudways, you can have your PHP apps up and running on managed cloud servers in just a few minutes.
Step 2: Launch Cloudways PHP Stack Application
Login to Cloudways Platform and launch a PHP stack application. In case of problems, refer to the following GIF.
Step 3: Start the Symfony Migration Process
Now launch SSH terminal (or download PUTTY) and login with your server’s Master Credentials.
You Might Also Like: Migrate PHP With Ease
Now, to access public_html folder of the application, enter the following command in the terminal.
cd applications/<your application name>/public_html/
where <your application name> can be found on the Cloudways platform by clicking on the newly added PHP application and then going to the Application Setting tab.
Now, inside the public_html, use the following command to remove all the files in the folder.
rm -rf *
The folder is now empty. The next step is to download the zip archive from the shared hosting Now the folder is empty let’s now download the zip that we have created in your shared hosting through the domain. For example, if your domain is abc.com then the download URL for the zip archive is abc.com/Smyfony.zip.
Is cPanel’s complexity and dated design slowing you down?
Cloudways makes web hosting easier and intuitive – even if you’re not a developer!
You Might Also Like: Pitfalls of Laravel Shared Hosting for Your Projects
In the terminal, type the following command to download the zip archive in the in the public_html folder.
Once done, unzip the file.
Next, edit Symfony database parameters from SSH terminal using the following command
Press i to start editing the file. Copy the database credentials from the Application Access Details and replace the existing credentials. Once done, press Esc and enter :wq to save and exit the file.
You might also like: Using multiple databases in Symfony on Cloudways
Next Import the database to Cloudways. For this, first download the database to public_html using the following command.
After the download finishes, type the following command to import the database into Cloudways.
mysql -u <username> -p <databasename> < database.sql
<databasename> can be found in Application Access details. The command will ask for the password.
Once the processing finishes, you should visit the staging URL of the PHP app to check out your Symfony based website/app.
You might also like: Symfony Performance Benchmarks on Cloudways
The Doctrine Migrations project offers the additional functionality of the DBAL and ORM for designing your database. It makes it simple and secure to send changes in a way that can be reviewed and tested before being sent to production.
In this tutorial, I discussed the process of Symfony migration to Cloudways in three simple steps. Here is a short introduction and list of major topics in this Symfony series. If you have any questions or would like to add to the discussion, please leave a comment below.
Customer Review at
“Cloudways hosting has one of the best customer service and hosting speed”
Sanjit C [Website Developer]
Inshal is a Content Marketer at Cloudways. With background in computer science, skill of content and a whole lot of creativity, he helps business reach the sky and go beyond through content that speaks the language of their customers. Apart from work, you will see him mostly in some online games or on a football field.