The infrastructure is among the crucial things you need while hosting your PHP websites. And among the cloud infrastructures, Google Compute Engine (GCE) has emerged as one of the most reliable options to host your PHP-powered websites.
Powered by Google, the GCE pledges to offer 99.99% uptime, thus allowing you to experience blazing-fast speed coupled with incredible performance.
Most website owners struggle to host their sites on GCE because of many technical complexities. Therefore, they seek hosting providers that efficiently manage their GCE server resources without hiccups.
Considering the users’ convenience, Cloudways has integrated Google Compute Engine into its cloud hosting platform. So with managed hosting like Cloudways, you can focus on your business while letting the platform manage your server.
The blog discusses everything about GCE and the easy steps to host your PHP apps. I’ve featured methods for both Cloudways and non-Cloudways users
Unleash the Power of PHP: Lightning-fast Hosting, Seamless Performance.
Experience the seamless blend of power, reliability, and simplicity that makes Cloudways the go-to choice for PHP hosting enthusiasts worldwide.
Host PHP on DigitalOcean
If you’re a Cloudways user, move over to this part as the method is much easier on Cloudways, allowing you to launch your apps in minutes.
Not a Cloudways user? No worries. You can follow the steps listed in this section to host your PHP apps on Google Cloud.
We will start with setting up a LAMP stack on a Google Virtual Machine and install a WordPress application on it. So, to start off:
- Create a Google Cloud Platform account.
- Verify your account by entering your credit card number.
- Follow the setup instructions and create your new account.
Create a New Compute Engine VM Instance
- Once you have verified your account, go to the Navigation Menu > Compute Engine > VM Instances.
- Currently, you will see no VM instance and project on your GCP, so click Create.
- Navigate to the Projects option from the top right menu bar and click the Create Project button to add a new project.
- Name your project. In this example, I have named it as PHPInstance.
- Select the account details, organization, and location details for your new project.
- Once done, click Create Project to create a new project.
- Click Create an Instance at the bottom of the screen.
- Choose your server configurations and other settings, including server location, machine type, and much more.
- The first section is the server name field. For this tutorial, I’m naming it php-google-server.
- Next, select the server location closest to your target audience. The server location is divided into two parts: Region and Zone.
* where Region is the geographical location of your server, and Zone is a deployment area of a server within a region.
- The next section is the machine configuration, where you can choose the machine family, series, and machine type.
As you can see in the image below, four options are available in the machine family section. I’m selecting General-purpose and series E2. From the machine type, you can choose the server computing power, vCPU, and RAM.
- We don’t need to change or update these details; so let’s go with the default settings.
- Next, go to the Boot Disk section to select an operating system you want to install on your Google Cloud server.
- If you wish to change your operating system or a different version like CentOS 8.5, click the CHANGE button and select your desired OS.
- Select “Allow default access” under Access scopes.
- Checkmark both Firewall rules, .i.e, allow HTTP/HTTPS traffic and DO NOT checkmark Observability – Ops Agent.
- Now that your VM instance creation process has been completed, you can click Create to launch your new server. It will take a few minutes to launch your Google Cloud server.
Once you have successfully created a Google Cloud server, it’s time to deploy the LAMP stack.
Deploy the LAMP Stack
- Confirm your Google Cloud server’s successful creation by hovering over the green check. If you see the same prompt, this means your instance has successfully launched.
- Launch your SSH server by clicking SSH.
- After that, you will see the Google terminal, where you will run numerous Linux commands to deploy your LAMP stack.
Run the following commands.
sudo apt update
//It will update the list of packages.
sudo apt upgrade -y
//It will upgrade the list of packages.
sudo apt install apache2 -y
//Installs Apache2 on your Google Cloud server.
- Copy your server IP and open it in a browser to confirm Apache’s successful installation.
Note: You haven’t installed an SSL certificate on your Google Cloud server, so you need to remove the “S” from HTTPS (browser URL); else, you will see errors like “This site can’t be reached.”
- The image below shows that the Apache2 Debian Default Page has been successfully installed on the GC server.
sudo apt install mariadb-server -y
//To install MariaDB on your Google Cloud server.
- sudo mysql_secure_installation
//To improve the security of your DB installation.
- After running the above command, you need to enter the root password. There’s no current password by default, so you just need to press Enter.
- If you want to set the root password for your database, press “y” and simply update it.
- Similarly, you can change other security settings as well:
After this, you need to install PHP and other modules as well:
- sudo apt install php php-fpm php-common php-mysql php-xml php-xmlrpc php-curl php-gd php-imagick php-cli php-dev php-imap php-mbstring php-opcache php-soap php-zip php-intl -y
//installs PHP and other modules.
- sudo systemctl restart apache2
//To restart Apache.
Congratulations! You have successfully installed PHP on your GCE instance you can confirm it by running the below command.
- php – – version
The above screen confirms that PHP has been successfully installed in your Google instance.
Host PHP Websites with Ease [Starts at $11 Credit]
- Free Staging
- Free backup
- PHP 8.0
- Unlimited Websites
Why Should You Host PHP Stack on Cloudways GCE?
Well, hosting your PHP-powered website on Cloudways GCE cloud servers has numerous advantages. But three advantages stand out. You can now host your PHP websites on Cloudways GCE in just a few clicks.
First things first! With GCE cloud servers, you get the maximum server-speed for your websites. All the GCE servers are optimized for breath-taking speed during peak times. The statistics reported by ServerDensity highlight network performance.
Secondly, there is no compromise on the performance of your cloud servers hosted on GCE infrastructure. All you get is a scintillating server performance with 99.99% uptime.
And thirdly, there is what you call scalability. You can easily scale your GCE cloud servers in just one click. In this way, you can handle unprecedented traffic spikes on your PHP website with ease.
Apart from these three outstanding features, there are many more exciting ones available. Some of them worth mentioning here include:
1. 24×7 tech support and server management2. Optimized servers with our special optimization recipe (Nginx, Varnish, Apache, Memcached)3. Dedicated IPs4. Ability to host multiple PHP websites with dedicated SSL protection on the same IP5. User-friendly control panel for server and application-related tasks6. Real-time server performance monitoring7. Limitless staging environments with mapped URLs for testing purposes8. Clone servers and applications9. Server scaling10. Automated offsite backups11. Git, SSL, SSH, and Cron Job Managers12. Addons for email, DNS, load testing, etc.
Host Your PHP Website on GCE Using Cloudways (Easier Method)
Hosting your PHP website on GCE infrastructure using Cloudways is easy. It takes only a few simple steps to start building your PHP web. To host your PHP-powered website on Cloudways GCE, follow these steps:
Step #1: Sign Up on Cloudways
First of all, you should sign up on Cloudways for a trial account with your user ID and password. Remember, you get a 3-day free trial for GCE on Cloudways.
Step #2: Select PHP Stack
Select PHP Stack from the available options in ‘Select your Application’.
Step #3: Select GCE
After signing up, you will see the server launching screen. Choose GCE from the given options in ‘Select Cloud’.
Step #4: Select Server Size
If you know your server size, click on ‘I know my server size’ tab and select your desired server-size. Otherwise, if you don’t know your server size, just click on the ‘Recommend Me’ tab. The system will ask you about expected user traffic and will recommend a suitable server size for you.
Step #5: Select Bandwidth
You can select the bandwidth requirement for your website on the Cloudways console as per your requirements.
Step #6: Select Storage For Your GCE Server
You can select storage sizes for your database and application files.
Step #7: Select Your Server Location
You can select any of the three locations (Asia, Europe, and the USA) to host your GCE cloud server. All three regions offer the same Ivy Bridge-powered infrastructure.
Step #8: Click “Launch”
Click the “Launch” button. In less than 8 minutes, your fully functional, speedy, and optimized GCE cloud server will be ready for PHP development.
Take your PHP projects to the next level
With lightning-fast load times, rock-solid security, and unmatched support, host your PHP projects on Cloudways and take your development game to the next level!
How Cloudways Gives a Better Cloud Hosting Experience
Cloudways manages all your servers and applications, providing you with a smooth and worry-free hosting experience. But what makes Cloudways so special? This section covers a few of the many factors that Cloudways uses to offer you an advanced cloud hosting experience.
Cloudways provides a unique stack of tools called Thunderstack, which comes pre-configured on all newly launched servers. The stack comprises all the major web tools that help optimize app performance – including Varnish, PHP-FPM, Redis, PHP 8.x, and more.
Using Thunderstack, administrators can easily enable/disable the services of these tools and can manage them according to the application’s needs.
Cloudways offers all the needed features to efficiently manage applications and their access levels. You can easily choose server and application-level access for your team using the SFTP/SSH access on the platform’s PHP Google Cloud hosting. This allows teams to collaborate on the project precisely, knowing their roles and personas related to the relevant project.
Moreover, administrators can easily schedule their daily operations based on priority using the CRON jobs management module. Just define the preferred PHP script in the module and automate your desired operation in a few minutes.
Cloudways provides pre-configured tools like Redis, Memcached, Varnish, and others to optimize server performance. Using these tools, you can efficiently enhance your application’s web performance and load time.
The platform also provides you with a graphical chart to monitor 15+ important server metrics. This gives you critical insights about your server performance and traffic usage, allowing you to take the required steps to improve the suggested metrics within time.
Cloudways provides advanced security features to protect your applications from potential web threats. From free SSL certificates to automated data backups, identity management to dedicated firewalls, and more, the Cloudways hosting platform offers several features to safeguard data from malicious hacking attempts.
PHP on Google Cloud (Cloudways) – Pricing & Plans
With the Cloudways platform, hosting your PHP app on Google Cloud is economical, as they provide pricing plans tailored to suit various budgets and requirements. You can get Cloudways GCE hosting for your applications at just $37.45/month.
Why Choose Cloudways Over Google Cloud Platform?
While Google Cloud Platform (GCP) undoubtedly offers a powerful infrastructure for hosting PHP applications, there are compelling reasons why Cloudways stands out as an excellent alternative.
Throughout this comparison, we have explored the unique features and advantages of Cloudways, which make it an attractive hosting platform for PHP app developers and businesses.
One of the most significant advantages of choosing Cloudways is its user-friendly interface and simplified setup process. Unlike GCP, which can be intimidating for beginners with its complex configuration and setup, Cloudways offers a seamless and intuitive experience.
With just a few clicks, users can deploy their PHP apps on Cloudways and manage their server environment effortlessly without needing advanced technical knowledge.
Unlike GCP, which requires users to handle most aspects of server management themselves, Cloudways takes care of server maintenance, security updates, and regular backups. This allows developers to focus on their PHP applications’ development and performance optimization while leaving the infrastructure management to the experts at Cloudways.
Unlock Your PHP Hosting Potential with Cloudways Excellence
Experience the trusted platform that empowers developers to unleash the full potential of PHP applications, making it the preferred choice for businesses worldwide
In conclusion, while Google Cloud Platform provides an impressive foundation for hosting PHP applications, Cloudways emerges as a compelling option due to its simplicity, managed services, transparent pricing, and flexibility in choosing cloud providers.
By choosing Cloudways, users can benefit from a hassle-free hosting experience, enabling them to focus on building exceptional PHP apps and delivering a seamless user experience.
Q) Can you run PHP on Google Cloud?
A) Yes, you can run PHP applications on Google Cloud. Google Cloud Platform (GCP) supports various ways to host and run PHP applications, allowing you to choose the most suitable option for your needs.
How to use Google Cloud for PHP?
Using Google Cloud for PHP involves a series of steps to set up and deploy your PHP application. Here’s a general guide to help you get started:
- Create a Google Cloud Platform (GCP) Account:
- Enable Billing.
- Create a New Project.
- Install & configure Google Cloud SDK.
- Choose hosting.
- Set up your PHP Application.
- Deploy to Google Cloud.
- Billing and cost management.
What PHP versions are supported on the Google Cloud Platform?
Google Cloud Platform supports all versions from the latest PHP 8.2 to PHP 7.4 End of Life.
Shahzeb is a Digital Marketer with a Software Engineering background, works as a Community Manager — PHP Community at Cloudways. He is growth ambitious and aims to learn & share information about PHP & Laravel Development through practice and experimentation. He loves to travel and explore new ideas whenever he finds time. Get in touch with him at [email protected]