How to install or migrate Laravel on cdmon hosting

How to install or migrate Laravel on cdmon hosting

Installing Laravel on your hosting account is a simple process, thanks to the new tools we have implemented. You can now activate Composer and other essential modules without needing to contact our support team. Below, we show you the steps to install Laravel on your hosting account or how to migrate a Laravel project from your local environment.
 
Composer activation
Migrate your Laravel from your local environment to the hosting
Installing a new Laravel on the hosting
 
Composer activation (Developer tools)
Previously, activating Composer required intervention from our support team. Now, this process has been simplified and you can activate it directly from the control panel. Follow these steps: 
  1. Log in to your cdmon account and access your hosting management from our control panel:
  
 
  1. From the hosting management section, look for "File managers" and select the option "Hosting for developers".
 
 
  1. Inside this section, you will find a button that allows you to activate the service. You just need to click the button to start the activation.
 
 
Migrate your Laravel from your local environment to the hosting
Most Laravel installations are developed locally and later published. In the following steps, we show you how to upload a Laravel installation to a cdmon hosting account:
 
1. Prepare the project locally
  1. Compress your Laravel project:
    • Before uploading the files, compress the entire project into a .zip or .tar.gz file. This will make the transfer easier and prevent incomplete uploads.
  2. Create a copy of the local database:
    • Access the database used by your Laravel project in your local environment.
    • Export the database to a .sql file using tools such as phpMyAdmin or the mysqldump command.
2. Create the database in cdmon
  1. Access the hosting management:
    • Log in to your cdmon panel and access the corresponding hosting management.
 
 
  1. Create a new MySQL database:
    • Go to the Databases section and access MySQL.
 
 
    • Create a new database on the hosting account, where you will be asked for the database name and encoding (we recommend UTF8):
 
 
    • Save this information (database name, username, and password), as you will need it to configure your Laravel project on the server.
 
3. Upload the files to the hosting
1.   Connect to your server using FTP:
Use an FTP client such as FileZilla to connect to your cdmon hosting account. Enter the hosting FTP credentials to connect. You can find more details about how to connect in our FileZilla connection guide.
 
2.   Upload the compressed file:
    • Once connected via FTP, navigate to the /web directory of your hosting account and upload the .zip or .tar.gz file you created earlier.
  1. Extract the compressed file:
    • To extract the file, you can use the tool in our control panel. Navigate to File managers and click on Extract files:
 
 
    • From here, you can specify the path and the name of the compressed file (for example “web/laravel.zip”).
 
 
4.   Configure Laravel on the hosting
  1. Modify the .env file:
    • Once the files have been extracted, you must configure Laravel to run on your server. Access the .env file in the project root (where you extracted Laravel).
o   Edit the following variables so they match your server configuration, especially those related to the database: Where to find MySQL connection details:
 
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_MySQL_username
DB_PASSWORD=your_MySQL_password
APP_URL=https://yourdomain.com
 
  1. Import the database:
Now you need to import the database you exported from your local environment. You can do this using FTP and the database import tool available in our control panel:
 
  • To run a MySQL script, first upload it via FTP to the "/backup_db" folder located in the root of the hosting account, at the same level as the "/web" folder.
  • Once the .sql file has been uploaded, proceed with its execution. To do so, go to the hosting management and click on the MySQL option in the "Databases" section.



  • Once inside, you will find the management menu called "SQL script execution", where you need to fill in several fields.
 

The fields to complete refer to the following:
  • Database: select the destination database you created earlier.
  • Encoding: select UTF8 or LATIN1 depending on the database encoding (usually UTF8).
  • File: the name of the file you want to load into the database.
 
Once the process is finished, you will receive an email indicating whether the execution was successful.
By following these steps, you can migrate your Laravel project from a local environment to your cdmon hosting account. We have simplified and detailed each step to make the process as clear as possible.
If your Laravel application uses caching, job queues, or other additional services, make sure to configure and test these services on our hosting.
 
Installing a new Laravel on the hosting
Once Composer is active on the hosting account, you can install Laravel. You must access your hosting via SSH to complete these steps.
 
Install Laravel manually
To do this, use the following command inside the folder where you want to install Laravel:
composer create-project --prefer-dist laravel/laravel app-name
 
Composer will download and install Laravel and its dependencies in the project folder.
 
Once downloaded, the next step is to configure Laravel’s .env file. Inside your Laravel project folder, you will find a file called .env. This file contains your application configuration. Open it and configure the environment variables, such as database settings and security keys, according to your needs. Where to find MySQL connection details
To verify that Laravel has been installed correctly, open the command console and run:
laravel --version
 
IMPORTANT: These steps apply when starting a completely new Laravel project. Most Laravel applications are developed locally and then uploaded to our hosting. In that case, the installation process is completely different. We suggest reviewing the Laravel migration section above if that applies to you.
 
We also want to mention that if you run phpinfo from the console, you can see all the modules active on the hosting account (after manually activating Composer and PHP). If you press the Tab key twice, the command console will display all available commands for your SSH user.
 
For more information, you can contact us.
    • Related Articles

    • How to manage our web hosting

      With the web hosting "Control Panel", you can easily manage your hosting. The panel consists of a section with hosting information and different sections with tools. To access the hosting management panel, in the "Basic service list", click on the ...
    • How to enable developer hosting

      The hosting for developers is a functionality that allows you to install essential tools for the development of web applications, such as the terminal client PHP (version 8.3), Composer, wp-cli, and the customers of GIT and SVN. Important: If you ...
    • Where to view hosting error logs

      The applications you install on your website may, under certain circumstances, generate errors that are recorded on the server. These errors can be of different types and you can view them in the Control Panel. To view the error log of your web ...
    • How to transfer an accommodation internally to another cdmon user

      At cdmon, you have the option to internally migrate or transfer a web hosting service to another user. In the Internal migration option that appears in the 'Product' section of the hosting management panel, you can perform different operations to ...
    • What is PHP Legacy and how does it affect your hosting at cdmon

      Many websites run on PHP, whether they use a CMS such as WordPress, Prestashop, Joomla or Moodle, or whether they are custom-developed. If your website generates dynamic content (for example, loads products, processes forms or displays changing ...