Skip to content

Commit e7f6cc4

Browse files
Update PHP on GCP learning path content
1 parent bdf0423 commit e7f6cc4

File tree

6 files changed

+86
-81
lines changed

6 files changed

+86
-81
lines changed

content/learning-paths/servers-and-cloud-computing/php-on-gcp/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ title: Deploy PHP on Google Cloud C4A Arm-based Axion VMs
44

55
minutes_to_complete: 30
66

7-
who_is_this_for: This is an introductory topic for software developers migrating PHP workloads from x86_64 to Arm-based servers, specifically on Google Cloud C4A virtual machines (VM) built on Axion processors.
7+
who_is_this_for: This is an introductory topic for developers migrating Hypertext Preprocesso (PHP) workloads from x86_64 to Arm-based servers, specifically on Google Cloud C4A virtual machines (VM) built on Axion processors.
88

99
learning_objectives:
10-
- Provision a SUSE SLES virtual machine on a Google Cloud C4A Arm-based Axion virtual machine
10+
- Provision a SUSE Linux Enterprise Server (SLES) virtual machine on a Google Cloud C4A Arm-based Axion virtual machine
1111
- Install PHP on a SUSE Arm64 C4A instance
1212
- Validate PHP functionality by running baseline HTTP server tests
1313
- Benchmark PHP performance using PHPBench on Arm64 architecture
Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
---
2-
title: Get started with PHP on Google Axion C4A on Arm Neoverse V2
2+
title: Get started with PHP on Google Cloud Axion C4A Arm VMs
33

44
weight: 2
55

66
layout: "learningpathall"
77
---
88

9-
## Google Axion C4A Arm instances in Google Cloud
9+
## PHP
1010

11-
Google Axion C4A is a family of Arm-based virtual machines powered by Google's Axion CPU, built with Arm Neoverse V2 cores. They deliver high performance and energy efficiency for cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications. The C4A series provides a cost-effective alternative to x86 virtual machines while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud.
11+
PHP (Hypertext Preprocessor) is an open-source, server-side scripting language designed for web development. You can embed PHP directly into HTML, making it easy to generate content dynamically on the server before sending it to the browser. PHP is widely used for websites, web applications, content management systems (CMS), and APIs. For more information, see the [PHP website](https://www.php.net/) and the [PHP documentation](https://www.php.net/docs.php).
1212

13-
For more information on Google Axion, see the Google blog [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu).
1413

15-
## PHP
14+
## Google Axion C4A
1615

17-
PHP (Hypertext Preprocessor) is an open-source, server-side scripting language designed for web development.
16+
Google Axion C4A is a family of Arm-based virtual machines powered by Google's Axion CPU, built with Arm Neoverse V2 cores. They deliver high performance and energy efficiency for cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications. The C4A series provides a cost-effective alternative to x86 virtual machines while leveraging the scalability and performance benefits of the Arm architecture in Google Cloud.
1817

19-
You use PHP to:
20-
- Create dynamic web pages
21-
- Interact with databases
22-
- Handle forms
23-
- Build web applications and APIs
18+
For more information on Google Axion, see the Google blog [Introducing Google Axion Processors, our new Arm-based CPUs](https://cloud.google.com/blog/products/compute/introducing-googles-new-arm-based-cpu).
2419

25-
You can embed PHP directly into HTML, making it easy to generate content dynamically on the server before sending it to the browser. PHP is widely used for websites, web applications, content management systems (CMS), and APIs. For more information, see the [PHP website](https://www.php.net/) and the [PHP documentation](https://www.php.net/docs.php).
20+
## What's next?
2621

27-
You’re now ready to begin deploying PHP workloads on Arm-based Google Cloud Axion C4A VMs. This Learning Path helps you optimize PHP for Arm servers, benchmark performance, and migrate from x86 to Arm with confidence.
22+
You’re now ready to begin deploying PHP workloads on Arm-based Google Cloud Axion C4A VMs. This Learning Path shows you how to optimize PHP for Arm servers, benchmark performance, and migrate from x86 to Arm with confidence.

content/learning-paths/servers-and-cloud-computing/php-on-gcp/baseline.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ layout: learningpathall
77
---
88

99

10-
## Baseline setup for PHP-FPM
10+
## Configure PHP-FPM baseline
1111
In this section, you’ll configure PHP-FPM (FastCGI Process Manager) on a SUSE Linux Arm-based Google Cloud Axion C4A virtual machine. You’ll set up the PHP-FPM pool and verify the FastCGI configuration. Next, you’ll connect PHP-FPM to Apache. These steps confirm that your Arm server is ready for dynamic PHP workloads.
1212

13-
## Configure the PHP-FPM pool
13+
## Set up the PHP-FPM pool
1414

15-
PHP-FPM (FastCGI Process Manager) runs PHP scripts in dedicated worker processes, independent of the web server. This design improves performance, security, and fault isolation—especially on multi-core Arm-based processors like Google Cloud Axion C4A VMs.
15+
PHP-FPM (FastCGI Process Manager) runs PHP scripts in dedicated worker processes, independent of the web server. You’ll notice better performance, stronger security, and improved fault isolation when you use multi-core Arm-based processors like Google Cloud Axion C4A VMs.
1616

1717
A pool is a group of PHP worker processes that serve FastCGI requests. You can use separate pools for different applications or virtual hosts to control resources more effectively.
1818

19-
## Copy the default configuration (if missing)
19+
## Copy the default configuration
2020

2121
If your PHP-FPM configuration files don't exist yet (for example, after a minimal installation in this Learning Path), copy the defaults into place using the commands below:
2222

2323
```console
2424
sudo cp /etc/php8/fpm/php-fpm.d/www.conf.default /etc/php8/fpm/php-fpm.d/www.conf
2525
sudo cp /etc/php8/fpm/php-fpm.conf.default /etc/php8/fpm/php-fpm.conf
2626
```
27-
These commands:
27+
These commands do the following:
2828
- Create a default pool configuration (`www.conf`) to control how PHP-FPM spawns and manages worker processes
2929
- Restore the main FPM service configuration (`php-fpm.conf`) if it’s missing
3030

31-
## Edit the configuration
31+
## Edit the PHP-FPM configuration
3232

3333
Open the PHP-FPM pool configuration file in a text editor:
3434

@@ -50,7 +50,7 @@ listen.group = www
5050
listen.mode = 0660
5151
```
5252

53-
Explanation of each directive:
53+
This table gives you an explanation of each directive:
5454
| Directive | Description |
5555
| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5656
| listen = /run/php-fpm/[www.sock](http://www.sock) | Configures PHP-FPM to communicate with Apache using a local Unix socket instead of a TCP port (`127.0.0.1:9000`). This reduces network overhead and improves performance. |
@@ -59,7 +59,7 @@ Explanation of each directive:
5959
| listen.mode = 0660 | Defines file permissions so that both the owner (`wwwrun`) and group (`www`) can read and write to the socket. This enables smooth communication between Apache and PHP-FPM. |
6060

6161

62-
## Start and enable PHP-FPM
62+
## Start and enable PHP-FPM service
6363

6464
After updating the configuration, restart the PHP-FPM service so it picks up the new settings:
6565

@@ -90,7 +90,7 @@ You should see output similar to:
9090
Oct 16 13:56:44 pareena-php-test systemd[1]: Starting The PHP FastCGI Process Manager...
9191
Oct 16 13:56:44 pareena-php-test systemd[1]: Started The PHP FastCGI Process Manager.
9292
```
93-
PHP-FPM is now active and ready to process requests via its Unix socket (`/run/php-fpm/www.sock`).
93+
PHP-FPM is now active and ready to process requests using its Unix socket (`/run/php-fpm/www.sock`).
9494
Next, you’ll configure Apache to communicate with PHP-FPM, allowing your Arm server to process and serve dynamic PHP pages.
9595

9696
## Install the Apache PHP8 module
@@ -106,26 +106,24 @@ sudo systemctl restart apache2
106106
```
107107
Next, you’ll test PHP execution by creating a simple PHP page and verifying that Apache can correctly render dynamic content.
108108

109-
## Test PHP
109+
## Test PHP functionality
110110
Now that PHP and Apache are installed, you can verify that everything is working correctly on your Arm-based VM.
111111

112-
## Create a test page
112+
## Create a PHP test page
113113
Create a simple PHP file that displays detailed information about your PHP installation:
114114

115115
```console
116116
echo "<?php phpinfo(); ?>" | sudo tee /srv/www/htdocs/info.php
117117
```
118118
This creates a file named `info.php` inside Apache’s web root directory (`/srv/www/htdocs/`). When you open this file in a browser, it displays the PHP configuration page.
119119

120-
## Test from inside the VM
120+
## Verify PHP from inside the VM
121121
You can verify that PHP and Apache are communicating correctly by testing the web server locally using curl:
122122

123123
```console
124124
curl http://localhost/info.php
125125
```
126-
- `curl` fetches the page from the local Apache server.
127-
- If PHP is working, you’ll see a large block of HTML code as output. This is the rendered output of the `phpinfo()` function.
128-
- This confirms that Apache successfully passed the request to the PHP interpreter and returned the generated HTML response.
126+
When you run the `curl` command, it fetches the PHP test page from the local Apache server. If PHP is configured correctly, you'll see a large block of HTML code in the output, which is the result of the `phpinfo()` function. This confirms that Apache is successfully passing requests to the PHP interpreter and returning the generated HTML response.
129127

130128
You should see output similar to:
131129

@@ -149,19 +147,23 @@ h2 a:link, h2 a:visited{color: inherit; background: inherit;}
149147
```
150148
This long HTML output represents the PHP configuration page content.
151149

152-
## Test from your browser
150+
## Verify PHP from your browser
153151
Now, verify that your PHP setup works correctly from outside the VM.
154152
Open a web browser on your local machine (such as Chrome, Firefox, or Edge) and enter the following URL in the address bar:
155153

156154
```console
157155
http://<YOUR_VM_PUBLIC_IP>/info.php
158156
```
159-
- Replace `<YOUR_VM_PUBLIC_IP>` with the public IP of your Google Cloud Axion C4A Arm VM.
157+
Replace `<YOUR_VM_PUBLIC_IP>` with the public IP of your Google Cloud Axion C4A Arm VM.
160158

161-
If everything is set up correctly, you’ll see a PHP Info page in your browser. It looks like this:
159+
If your configuration is correct, your browser displays the PHP Info page. This page shows detailed information about your PHP environment, including version, build options, and loaded modules, as shown below:
162160

163-
![PHP-info page alt-text#center](images/php-web.png "Figure 1: PHP info")
161+
![Screenshot of PHP info page in browser showing PHP configuration details on Google Cloud Axion C4A Arm VM. alt-text#center](images/php-web.png "PHP info page in browser on Google Cloud Axion C4A Arm VM")
164162

165163
Successfully loading the PHP Info page in your browser confirms that your PHP and Apache environment on Google Cloud Axion C4A Arm is configured and functioning properly.
166164

165+
## What's next?
166+
167167
You’ve validated your PHP baseline setup on an Arm-based Google Cloud VM. You’re ready to move on to benchmarking and performance testing for your PHP workloads on Arm.
168+
169+
Next, you’ll learn how to measure PHP performance on Google Cloud Axion C4A Arm VMs. You’ll use benchmarking tools to evaluate throughput, latency, and resource utilization. This helps you optimize your PHP environment for production workloads and identify areas for improvement.

content/learning-paths/servers-and-cloud-computing/php-on-gcp/benchmarking.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ layout: learningpathall
88

99
## PHP benchmarking using PHPBench
1010

11-
In this section, you will learn how to benchmark PHP performance using PHPBench, a modern and extensible benchmarking framework for PHP applications. You will install PHPBench, run sample tests, and interpret key metrics such as mode time, variance, and throughput. You will then analyze the results to understand how your Google Cloud C4A (Axion Arm64) virtual machine performs on common operations like string manipulation and array processing.
12-
13-
PHPBench is a flexible micro-benchmarking tool designed to measure PHP code performance precisely and repeatably.
11+
In this section, you will learn how to benchmark PHP performance using PHPBench, a modern and extensible benchmarking framework for PHP applications. You will install PHPBench, run sample tests, and interpret key metrics such as mode time, variance, and throughput. You will then analyze the results to understand how your Google Cloud C4A (Axion Arm64) virtual machine performs on common operations like string manipulation and array processing. PHPBench is a flexible micro-benchmarking tool designed to measure PHP code performance precisely and repeatably.
1412

1513
With PHPBench, you can:
1614
* Measure the execution time of PHP functions or code blocks
@@ -93,7 +91,7 @@ This installs `phpbench` in your user's global Composer directory, typically loc
9391

9492
## Add Composer global bin to PATH
9593

96-
To make `phpbench` accessible from any terminal session, add Composer's global binary path to your system's environment PATH:
94+
To make `phpbench` accessible from any terminal session, add Composer's global binary path to your system's environment `PATH`:
9795
```console
9896
export PATH="$HOME/.config/composer/vendor/bin:$PATH"
9997
echo 'export PATH=$HOME/.config/composer/vendor/bin:$PATH' >> ~/.bashrc
@@ -160,9 +158,7 @@ class ExampleBenchmark
160158
```
161159
This sets up two basic benchmark tests, string concatenation and array push.
162160

163-
- @Revs(1000): Each benchmark repeats 1000 times per iteration.
164-
- @Iterations(5): The benchmark runs 5 separate iterations and averages results.
165-
- `benchStringConcat` and `benchArrayPush`: Sample benchmarks for string and array operations.
161+
The `@Revs(1000)` annotation ensures each benchmark function is executed 1,000 times per iteration, while `@Iterations(5)` means the benchmark runs five separate iterations and averages the results for greater accuracy. The sample benchmarks, `benchStringConcat` and `benchArrayPush`, measure the performance of string concatenation and array operations, respectively.
166162

167163
## Run the benchmarks
168164

@@ -185,20 +181,19 @@ with PHP version 8.0.30, xdebug ❌, opcache ❌
185181
Subjects: 2, Assertions: 0, Failures: 0, Errors: 0
186182
```
187183

188-
## Understanding PHP benchmark metrics and results with PHPBench
184+
## Understanding PHPBench metrics and results
185+
186+
PHPBench reports several key metrics to help you understand your code's performance, as defined in the table below:
189187

190-
- **benchStringConcat** → Name of the benchmark function; in this case, it measures string concatenation performance.
191-
- **benchArrayPush** → Name of another benchmark function; here, measuring array push performance.
192-
- **xdebug ❌** → Xdebug extension is disabled, which is good because Xdebug slows down execution.
193-
- **opcache ❌** → Opcache is disabled, so you’re measuring raw execution without caching optimizations.
194-
- **I4** → Number of iterations per measurement.
195-
- `I4` means 4 iterations of this benchmark were executed for one measurement.
196-
- **Mo13.438μs** → Mode (or mean) execution time for the benchmark.
197-
- `Mo` = Mode, showing the most common measured execution time across iterations.
198-
- `13.438 μs` = 13.438 microseconds per iteration.
199-
- **(±0.82%)** → Variation or coefficient of variation in the measurements.
200-
- Shows consistency of results.
201-
- Lower percentage → more stable and reliable benchmark.
188+
| Metric/Term | Meaning |
189+
|---------------------|-----------------------------------------------------------------------------------------------------------|
190+
| **benchStringConcat** | Name of the benchmark function; measures string concatenation performance. |
191+
| **benchArrayPush** | Name of the benchmark function; measures array push performance. |
192+
| **xdebug ❌** | Xdebug extension is disabled, which is good because Xdebug slows down execution. |
193+
| **opcache ❌** | Opcache is disabled, so you’re measuring raw execution without caching optimizations. |
194+
| **I4** | Number of iterations per measurement. `I4` means 4 iterations of this benchmark were executed per run. |
195+
| **Mo13.438μs** | Mode (most common) execution time for the benchmark. `13.438 μs` = 13.438 microseconds per iteration. |
196+
| **(±0.82%)** | Variation or coefficient of variation in the measurements. Lower percentage means more stable results. |
202197

203198

204199
## Benchmark summary on Arm64
@@ -222,10 +217,13 @@ For comparison, the same PHPBench test suite was executed on a Google Cloud c4-s
222217

223218
When comparing benchmark results between Google Cloud Axion C4A (Arm64) and x86-based C4 (x86_64) instances, you will see:
224219

225-
The results show that both architectures deliver nearly identical execution times for typical PHP operations, with Arm64 showing slightly lower variation (more stable performance). The Arm64 instance performs within ~15% of x86_64, showing strong memory throughput and cache performance for dynamic array allocation workloads.
226-
Low variance (±0.82% / ±0.51: Indicates that the Axion-based Arm cores on C4A provide stable, repeatable performance, ideal for predictable PHP application behavior in production.
220+
- The results show that both architectures deliver nearly identical execution times for typical PHP operations, with Arm64 showing a slightly lower level of variation which indicates more stable performance.
221+
- The Arm64 instance performs within ~15% of x86_64, showing strong memory throughput and cache performance for dynamic array allocation workloads.
222+
- Low variance (±0.82% / ±0.51) indicates that the Axion-based Arm cores on C4A provide stable, repeatable performance, ideal for predictable PHP application behavior in production.
223+
224+
## Summary
227225

228-
These results show that PHP performs consistently across both architectures, and that Google Cloud Axion C4A Arm64 VMs deliver competitive, reliable performance for PHP-based web and backend applications.
226+
These results show that PHP performs consistently across both architectures, and that Google Cloud Axion C4A Arm64 VMs deliver competitive, reliable performance for PHP-based web and backend applications. You can confidently deploy PHP workloads on Arm64 instances, knowing that performance is stable and comparable to x86_64 systems. This benchmarking process helps you identify areas for optimization and ensures your applications run efficiently on Arm platforms. As you continue developing and scaling PHP solutions, regularly benchmarking on Arm64 will help you maintain high performance and take advantage of the cost and energy efficiency benefits offered by Arm-based cloud infrastructure.
229227

230228

231229

0 commit comments

Comments
 (0)