Deployment of JavaScript and PHP applications
All our web hosting plans support PHP (backend) and JavaScript (frontend) applications, built with any framework, libraries or package manager, using SQLite or MySQL. In this guide we describe the process of uploading these applications created on a local server (e.g. XAMPP) to a hosting account:
Uploading an application to a hosting account
- Before uploading the application, all dependencies should already be installed, for example with
composer installandnpm run buildor the package manager commands we are using. - We ensure the application works correctly on the local server.
- With the above checked, we start uploading the files. On our machine, we compress the project folder and upload it via FTP:
- Now on the server, connected by SSH or with the panel’s file browser, we unzip the folder outside the public directory (public_html, httpdocs, etc.).
- We copy the files from the project’s public folder (where index.html or index.php is) to the account’s public folder mentioned above.
General steps
- If the application uses local MySQL databases, it will be necessary to create them within the control panel:
- When we created the application, we likely configured the database connection (in a PHP file, .env, .conf, etc.). We will probably need to change the following parameters:
- Port: 3306.
- Name: the name with which we recreated the database in the panel.
- User: the database user we created in the panel.
- Password: the password with which we recreated the database in the panel.
- SQLite databases should work without changes.
- Normally, JavaScript frameworks will work by default.
Laravel
- In Laravel, the index.php file contains the paths to the Laravel files, which remained in the folder we unzipped earlier. One option is to move the contents of that folder to the public folder. The other is to modify index.php.
- If we want to modify index.php, we must look for the file and folder paths and change them. If the folder we unzipped is called laravel, we would change the paths that started with …/ to …/laravel/, or to …/[folder]/ with the name we unzipped. For example:
'/../storage/framework/maintenance.php' -> '/../laravel/storage/framework/maintenance.php'
'/../vendor/autoload.php' -> '/../laravel/vendor/autoload.php'
'/../bootstrap/app.php' -> '/../laravel/bootstrap/app.php'
- If we have not moved the contents of the original folder to the public folder, we should at least move the build folder so the site works.