Search
Search the entire web effortlessly
maxresdefault   2025 05 02T204157.445
A Comprehensive Guide to Deploying Vanilla PHP Applications on Cloudways

Deploying a web application is a pivotal moment in the development cycle, marking the transition from local development to a live environment. In this article, we’ll explore how to seamlessly deploy a vanilla PHP application on Cloudways, a managed hosting provider that simplifies the deployment process.

Why Choose Cloudways for PHP Deployment?

Cloudways stands out as a managed hosting solution that alleviates the complexities of server management, making it an excellent choice for developers aiming to focus on building applications rather than managing infrastructure. Here are key benefits of using Cloudways:

  • Simplified Management: Cloudways manages configuration and security, freeing you from server management tasks.
  • Performance: Each server is equipped with dedicated resources, ensuring optimal performance for your applications.
  • Flexibility: Choose from multiple hosting platforms like DigitalOcean, AWS, or Google Cloud, adapting to varied project requirements.
  • Scalability: Easily scale up your resources based on your application’s demands.

Getting Started with Cloudways

To start deploying your PHP application on Cloudways, follow these structured steps:

Step 1: Create Your Cloudways Account

  1. Navigate to Cloudways.
  2. Click on the Start Free button to sign up.
  3. Fill out the required information. Use promo code GIO15 for a hosting credit that covers roughly 1-2 months of free hosting.

Once your account is created, you’ll be directed to the server creation page.

Step 2: Set Up Your Server

  1. On the server creation page, you will find presets for different applications. Select Custom App to deploy your PHP application.
  2. Input the application name, select the server type, and choose the hosting provider. Based on your budget and project size, DigitalOcean is a reliable starting option.
  3. Next, select the server location nearest to you for optimal performance, then click Launch Now.

Server setup can take a few minutes. During this time, you can look forward to managing your server once it is live.

Step 3: Managing Your Server

Upon server activation, access the management dashboard. It comprises various sections:

  • Master Credentials: Find your SSH/SFTP access details here.
  • Monitoring: Keep an eye on server resource usage.
  • Managed Services: Lists key services like Apache, MySQL, Nginx, etc.
  • Settings & Packages: Here, you can modify server settings like memory limits, execution limits, and PHP versions. For instance, ensure you’re using PHP 8.0 for compatibility.

Step 4: SSH into Your Server

Use the SSH details to log into your server:

ssh username@server_ip

Replace username and server_ip with your actual details. Once logged in, navigate to the applications directory:

cd applications
cd your_application_directory

Step 5: Deploying Your Application

To deploy the application:

  1. Delete the default index.php file generated by Cloudways.
  2. Navigate to your public_html directory and upload your application files.
  3. If using Git for deployment, set up deploy keys in your Git repository settings.

Configuring Your Application

  • Update your .env file with your database credentials after performing composer install to ensure all dependencies are loaded correctly.
  • Run migration commands to create the necessary tables in your database:
vendor/bin/doctrine migrations:migrate
  • Configure an .htaccess file in your public directory to route requests correctly.

Step 6: Testing and Troubleshooting

After deployment, check your application URL. If encountering errors, such as HTTP Error 500, verify your error logs to troubleshoot common issues related to dependencies or configuration mistakes.

Step 7: Ongoing Maintenance

For continuous deployment, you will need to manually run:

  • Composer install for dependency updates.
  • Re-run migrations as necessary.
  • Pull new updates from your repository via Git when deploying new changes.

Cloudways also supports automation through GitHub Actions, which can streamline this process in the future.

Conclusion

Deploying a vanilla PHP application on Cloudways is straightforward, offering both flexibility and performance without the complexity of traditional server management. Cloudways not only provides a safe and efficient deployment environment but also allows you to focus on what matters the most—developing your application.

For those who may require help with complex setups or additional features like SMTP configuration or staging environments, feel free to reach out in the comments, and we can assist in creating tailored content or solutions.

Whether you’re launching a small project or scaling an existing application, using a robust platform like Cloudways can significantly enhance your development and deployment experience.

Don’t forget to share your thoughts and subscribe for more insightful tutorials!