If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

How to organize work with laravel on shared hosting?

Started by youngceaser, Mar 25, 2023, 12:02 AM

Previous topic - Next topic

youngceaserTopic starter

Hi, I developed a Laravel website and successfully deployed it on a virtual hosting server. However, when it comes to making changes to the view and controllers, I start encountering various problems. Sometimes, I forget to transfer all the edited files to the FTP hosting or accidentally overwrite some. As a result, it becomes confusing to track what files are on the hosting server and what I have locally.

This chaotic situation is consuming a significant amount of my time and hindering productivity. Is there any recommended approach or best practices for managing a Laravel project on virtual hosting? Or should I consider transitioning to a UPU (Unified Platform for Development) to streamline the workflow?
  •  


tanuja19

I apologize, but could you clarify how your question specifically pertains to virtual hosting? It appears to me that the issue revolves around workflow organization rather than virtual hosting, let alone Laravel.

In PHPStorm, the FTP deployment feature is well-equipped to handle any virtual hosting setup seamlessly.
  •  

sujitbikash

If you already have a registered domain, you can add it to the "Domains and subdomains" section by simply clicking on the "Add domain" button. Alternatively, you have the option to register a new domain within the same section. While registering or transferring a domain, make sure to create a site directory that will be associated with the domain (or choose an existing one).

Furthermore, you have the provision to create a directory in the "Sites" section by using the "Create a new site" button. Please ensure that the directory name does not exceed 40 characters. Additionally, select PHP version 7.2 and enable SSH access for a seamless connection. Lastly, execute the following commands:

# go to the folder with the new site:
cd newmegasite.com
 # to access the desired version of php use
/opt/phpVERSION/bin/php
# install laravel
composer create-project -- prefer-dist laravel/laravel laravel
# delete the public_html folder
rm -r public_html
# set up a symlink as the webserver should look in the public folder
ln -s ~/newmegasite.com/laravel/public ~/newmegasite.ru/public_html
  •  

kushalmalik

Managing a Laravel project on a virtual hosting server can be challenging, especially when it comes to synchronizing changes between your local development environment and the server. There are a few recommended approaches and best practices to help streamline your workflow and avoid confusion:

1. Version Control: Utilize version control systems like Git to keep track of changes made to your codebase. This allows you to easily manage and synchronize code between your local environment and the hosting server.

2. Deployment Scripts: Automate your deployment process by creating deployment scripts that handle file transfers, updates, and backups. Tools like Laravel Envoy or custom deployment scripts using tools like rsync can simplify the process.

3. Environment Configuration: Ensure that your local development environment configuration matches that of the hosting server. Use environment variables or configuration files to set up different environments (e.g., development, production) to avoid any conflicts or surprises during deployment.

4. Continuous Integration and Deployment: Consider using continuous integration and deployment (CI/CD) tools like Jenkins, Travis CI, or GitLab CI/CD. These tools automate the deployment process by building, testing, and deploying your application whenever changes are pushed to the repository.

5. Development Environments: Consider setting up a local development environment similar to your hosting server. Tools like Docker or Vagrant can help replicate the server environment locally, reducing discrepancies and ensuring consistent behavior.

Regarding transitioning to a Unified Platform for Development (UPU), it depends on your specific needs and requirements. UPU solutions often provide an integrated development environment, version control, deployment tools, and collaboration features in a unified platform. This can streamline your workflow and help avoid the issues you're facing. However, transitioning to a new platform requires effort and consideration, so carefully evaluate the benefits and drawbacks before making a decision.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...