X
    Categories: FeaturedLearn PHP Tutorials, Tips And Guides

Here’s How to Host PHP Applications On Linode Servers

Cloudways is increasing its infrastructure by adding more server providers. Previously you have five providers including  Linode, Vultr, Amazon, Kyup, and GCE to launch PHP servers on but a new addition to the family is Linode. Recently Linode is also integrated into Cloudways infrastructure so you can now launch PHP server onLinodee via Cloudways managed platform.

Linode is long loved by developers because of its robustness and developer friendly environment. Cloudways has also added an optimization layer by providing the managed Thunder stack on linode servers. 

Cloudways ThunderStack

As a developer, you must be familiar with the concept of the stack – an arrangement of servers and cache that form the underlying hosting solution for your applications.

To provide fast blazing speed and a glitch-free performance, Cloudways has built a PHP stack, known as ThunderStruck. This stack consists of technologies that offer maximum uptime and page load speed to all PHP applications. Here are the major components of the Thunderstruck:

As you can see, ThunderStack comprises of a mix of static and dynamic caches with two web servers, Nginx and Apache. This combination ensures the ultimate experience for the users and visitors of your application.

Deploying PHP Applications on Linode Server

You will see the power of the Cloudways Platform right away in the first step! Signing up for your account at Cloudways  takes a few minutes only!

To set up a PHP 7 server on Linode at Cloudways, simply sign up for your Cloudways account, and login using your newly acquired login credentials. Next, at the server launch page, select Custom PHP App as your application & Linode as your infrastructure provider. Next, identify your server resource needs along with other required details. And you’re done! Your Linode server will now be deployed. By default you will get PHP 7.0 on server. However, you can upgrade or downgrade to any of the three versions, 5.6,7.0,7.1.

Now, go to Servers >> Settings & Packages tab. There are three sub tabs: Basic, Advanced and Packages. In the Basic tab, you can set basic PHP attribute values such as Execution limit, Upload Size, Memory Limit and Error Reporting.

In the Advanced tab, you can set up advance attribute values for Nginx, Apache, MySQL and PHP including Max input variables, Xdebug, Opcache Memory, Max Connection limit,HTTP2. You can simply input the values and use toggles for enabling and disabling options.

In the Packages tab, you can easily downgrade PHP version to 5.6, if your application requires it. In addition, you can choose between MySQL or MariaDB as you preferred database driver.

Deploying PHP Application on Linode From GitHub

You likely have your PHP application on GitHub. No problem, because you could easily deploy it on the Cloudways Platform. The Platform has a simple system for direct deployment of your application from Git repositories.

To deploy the application from a Git repo, first, in the Platform dashboard, click the ‘Applications’ tab from the top menu bar and select your application from the list that pops down. You will now need a mechanism to generate and download the SSH keys that are the critical-authentication aspect of the process.

To do this, click on the ‘Deployment via Git’ button in the ‘Application Management’ area, and then click the ‘Generate SSH Keys’ button to generate your unique SSH key. To download these keys, simply click on ‘Download SSH Keys’.

To allow Cloudways to access your application on the Git repository, upload the ‘SSH Public Key’ (that you have just downloaded in the previous step) to the GitHub.

To do this, login to your GitHub account, go to the desired repository, and into the ‘Settings’ tab. Here, locate the ‘Add Deploy Key’ button and use it to add the SSH Public Key. You can do this by opening the file downloaded in the previous step and pasting its content into the space provided by the GitHub. Click on the ‘Add Key’ button to finalize the input of the SSH key.

You will also need a path link to allow GitHub to communicate with the Cloudways Platform. This path is provided by the ‘Repository SSH Address’ that you will see in the top panel in your main GitHub dashboard. Copy and paste this address in your Cloudways’ ‘Git Remote Address’ field.

Next you need to input the deployment path and click on ‘Start Deployment’ button to have your application code deployed onto the Cloudways platform!

PHP-FPM, Varnish & Cron Settings

Cloudways provides custom UI panel to set and maintain PHP-FPM and Varnish settings. Although the default configuration is already in place, you could easily change all the settings to suit your own particular development related requirements. In Varnish settings, you can define URL that are to be excluded from caching. You can also set permissions in this panel.

Cron jobs are a very commonly used component of PHP application development process. On Cloudways Platform, you could easily set up cron jobs in just a few clicks. Just declare the PHP script URL and the time when the script will run.

Pre-Installed Composer & Git

PHP development requires working with external libraries and packages. Suppose you are working with Laravel and you need to install an external package. Since Composer has become the standard way of installing packages, it comes preinstalled on the Cloudways platform. Just launch the application and start using Composer in your project.

Similarly, if you are familiar with Git and maintain your project on GitHub or BitBucket, you don’t need to worry about Git installation. Git also comes pre-configured on Cloudways. You can start running commands right after application launch.

Conclusion

Managed Linode servers are ready to boost your PHP application on Cloudways. You can see everything is on mouse click whether they are PHP services, Application Settings, SSL installations etc. So start launching Linode servers and post your queries in comments if any.

Shahroze Nawaz: Shahroze is a PHP Community Manager at Cloudways - A Managed PHP Hosting Platform. He’s always in search of new frameworks and methods to implement them. Besides his coding life, he loves movies and playing soccer with friends. You can email him at shahroze.nawaz@cloudways.com