Skip to content

Commit 720022d

Browse files
Refine PHP on GCP documentation for clarity and consistency
1 parent 5843e93 commit 720022d

File tree

6 files changed

+83
-69
lines changed

6 files changed

+83
-69
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,7 +4,7 @@ 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 software developers migrating 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:
1010
- Provision a SUSE SLES virtual machine on a Google Cloud C4A Arm-based Axion virtual machine
@@ -28,7 +28,7 @@ armips:
2828

2929
tools_software_languages:
3030
- PHP
31-
- apache
31+
- Apache
3232
- PHPBench
3333

3434
operatingsystems:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ You can embed PHP directly into HTML, making it easy to generate content dynamic
2626

2727
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).
2828

29-
You’re 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.
29+
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.

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

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

99

10-
## Baseline Setup for PHP-FPM
11-
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, verify FastCGI configuration, connect PHP-FPM to Apache, and confirm that your Arm server is ready for dynamic PHP workloads.
10+
## Baseline setup for PHP-FPM
11+
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+
## Configure the PHP-FPM pool
1414

1515
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.
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 (if missing)
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

@@ -25,10 +25,10 @@ sudo cp /etc/php8/fpm/php-fpm.d/www.conf.default /etc/php8/fpm/php-fpm.d/www.con
2525
sudo cp /etc/php8/fpm/php-fpm.conf.default /etc/php8/fpm/php-fpm.conf
2626
```
2727
These commands:
28-
- Create a default pool configuration (`www.conf`) to control how PHP-FPM spawns and manages worker processes.
29-
- Restore the main FPM service configuration (`php-fpm.conf`) if it’s missing.
28+
- Create a default pool configuration (`www.conf`) to control how PHP-FPM spawns and manages worker processes
29+
- Restore the main FPM service configuration (`php-fpm.conf`) if it’s missing
3030

31-
### Edit the Configuration
31+
## Edit the configuration
3232

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

@@ -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
6363

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

@@ -109,15 +109,15 @@ Next, you’ll test PHP execution by creating a simple PHP page and verifying th
109109
## Test PHP
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 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+
## Test 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
@@ -149,7 +149,7 @@ h2 a:link, h2 a:visited{color: inherit; background: inherit;}
149149
```
150150
This long HTML output represents the PHP configuration page content.
151151

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

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

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

99

10-
## PHP Benchmarking using PHPBench
10+
## PHP benchmarking using PHPBench
1111

1212
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.
1313
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.
1414

15-
PHPBench is a flexible micro-benchmarking tool designed to measure PHP code performance precisely and repeatably. It allows developers to:
16-
* Measure the execution time of PHP functions or code blocks.
17-
* Identify performance regressions between versions.
18-
* Automate performance testing across CI/CD pipelines.
19-
* Track results over time to detect optimizations or slowdowns.
15+
PHPBench is a flexible micro-benchmarking tool designed to measure PHP code performance precisely and repeatably.
2016

21-
### Download Composer Installer
17+
It allows developers to do the following:
18+
* Measure the execution time of PHP functions or code blocks
19+
* Identify performance regressions between versions
20+
* Automate performance testing across CI/CD pipelines
21+
* Track results over time to detect optimizations or slowdowns
22+
23+
## Download Composer installer
2224

2325
Before installing PHPBench, you need Composer, which is PHP's dependency manager. Composer handles library installations, versioning, and autoloading, ensuring tools like PHPBench run consistently across environments.
2426

@@ -29,7 +31,7 @@ sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
2931

3032
This command downloads a PHP script called `composer-setup.php`, which will install Composer.
3133

32-
### Install the phar extension
34+
## Install the phar extension
3335

3436
Composer requires PHP's phar (PHP Archive) extension to run. This extension allows PHP to execute .phar archive files, self-contained PHP applications like Composer and PHPBench are distributed in this format.
3537

@@ -38,7 +40,7 @@ Install the extension with:
3840
sudo zypper install -y php8-phar
3941
```
4042

41-
### Install Composer system-wide
43+
## Install Composer system-wide
4244

4345
Now, install Composer globally so it is available for all users and can be executed from any directory:
4446

@@ -56,7 +58,7 @@ Use it: php /usr/local/bin/composer
5658
```
5759
Composer is now installed system-wide at /usr/local/bin/composer and ready to manage PHP dependencies.
5860

59-
### Remove the installer script
61+
## Remove the installer script
6062

6163
After successfully installing Composer, remove the installer file to keep your environment clean:
6264

@@ -65,7 +67,7 @@ sudo php -r "unlink('composer-setup.php');"
6567
```
6668
Since Composer is now installed system-wide, the installer file is no longer needed.
6769

68-
### Verify Composer installation
70+
## Verify Composer installation
6971
To confirm that Composer was installed correctly and is accessible globally, run:
7072

7173
```console
@@ -80,7 +82,7 @@ Run the "diagnose" command to get more detailed diagnostics output.
8082

8183
Composer is now successfully installed and you can proceed to installing PHPBench.
8284

83-
### Install PHPBench globally
85+
## Install PHPBench globally
8486

8587
PHPBench is a powerful benchmarking tool for measuring the performance of PHP code. Install it globally using Composer so you can access it from any directory:
8688

@@ -90,7 +92,7 @@ composer global require phpbench/phpbench
9092

9193
This installs `phpbench` in your user's global Composer directory, typically located under `$HOME/.config/composer/`
9294

93-
### Add Composer global bin to PATH
95+
## Add Composer global bin to PATH
9496

9597
To make `phpbench` accessible from any terminal session, add Composer's global binary path to your system's environment PATH:
9698
```console
@@ -99,7 +101,7 @@ echo 'export PATH=$HOME/.config/composer/vendor/bin:$PATH' >> ~/.bashrc
99101
source ~/.bashrc
100102
```
101103

102-
### Verify PHPBench installation
104+
## Verify PHPBench installation
103105
Once installed, verify that PHPBench is working correctly:
104106
```console
105107
phpbench --version
@@ -111,15 +113,15 @@ phpbench 1.2.14
111113
```
112114
PHPBench is now installed and ready to run.
113115

114-
### Create a Benchmark Directory
116+
## Create a benchmark directory
115117

116118
Create a new PHP benchmark file using your preferred text editor:
117119

118120
```console
119121
mkdir ~/phpbench-tests
120122
cd ~/phpbench-tests
121123
```
122-
### Create a Benchmark Script
124+
## Create a benchmark script
123125

124126
Create a new PHP benchmark file using your preferred editor:
125127

@@ -163,7 +165,7 @@ This sets up two basic benchmark tests, string concatenation and array push.
163165
- @Iterations(5): The benchmark runs 5 separate iterations and averages results.
164166
- `benchStringConcat` and `benchArrayPush`: Sample benchmarks for string and array operations.
165167

166-
### Run the Benchmarks
168+
## Run the benchmarks
167169

168170
Execute the benchmark suite you created using the `phpbench run` command:
169171

@@ -184,7 +186,7 @@ with PHP version 8.0.30, xdebug ❌, opcache ❌
184186
Subjects: 2, Assertions: 0, Failures: 0, Errors: 0
185187
```
186188

187-
### Understanding PHP benchmark metrics and results with PHPBench
189+
## Understanding PHP benchmark metrics and results with PHPBench
188190

189191
- **benchStringConcat** → Name of the benchmark function; in this case, it measures string concatenation performance.
190192
- **benchArrayPush** → Name of another benchmark function; here, measuring array push performance.
@@ -200,7 +202,7 @@ Subjects: 2, Assertions: 0, Failures: 0, Errors: 0
200202
- Lower percentage → more stable and reliable benchmark.
201203

202204

203-
### Benchmark summary on Arm64
205+
## Benchmark summary on Arm64
204206

205207
Results from the benchmark suite executed on a Google Cloud c4a-standard-4 (Arm64) instance with 4 vCPUs and 16 GB memory, running SUSE Linux:
206208
| Benchmark Function | Iterations | Mode Execution Time (μs)| Variation (%) | Notes |
@@ -209,15 +211,15 @@ Results from the benchmark suite executed on a Google Cloud c4a-standard-4 (Arm6
209211
| benchArrayPush | I4 | 8.487 μs | ±0.51% | Measures performance of pushing elements to an array|
210212

211213

212-
### Benchmark summary on x86_64
214+
## Benchmark summary on x86_64
213215
For comparison, the same PHPBench test suite was executed on a Google Cloud c4-standard-4 (x86_64) instance with 4 vCPUs and 15 GB memory, running SUSE Linux:
214216

215217
| Benchmark Function | Iterations | Mode Execution Time (μs) | Variation (%) | Notes |
216218
|---------------------|------------|----------------|---------------|------------------------------------------------|
217219
| benchStringConcat | I4 | 13.493 | ±1.80% | Measures performance of string concatenation |
218220
| benchArrayPush | I4 | 7.395 | ±1.07% | Measures performance of pushing elements to an array |
219221

220-
### PHP performance benchmarking comparison on Arm64 and x86_64
222+
## PHP performance benchmarking comparison on Arm64 and x86_64
221223

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

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

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,42 @@ weight: 4
66
layout: learningpathall
77
---
88

9-
## Install PHP
10-
In this section, you will install PHP together with the Apache web server and several commonly used PHP extensions on a SUSE Arm-based virtual machine. This forms the foundation for running and serving dynamic PHP applications on Arm-based machines.
9+
## Install PHP
10+
In this section, you’ll install PHP, the Apache web server, and several commonly used PHP extensions on a SUSE Arm-based virtual machine. This setup forms the foundation for running and serving dynamic PHP applications on Arm-based machines.
1111

12-
### Update the system
12+
## Update the system
1313
Before installing any software, make sure your system has the latest packages and security patches:
1414

1515
```console
1616
sudo zypper refresh
1717
sudo zypper update -y
1818
```
1919

20-
### Install PHP, Apache, and common extensions
21-
Now install PHP, PHP-FPM, Apache web server, and some commonly used PHP extensions by using the following command:
20+
## Install PHP, Apache, and common extensions
21+
Install PHP, PHP-FPM, Apache web server, and some commonly used PHP extensions by running:
2222

2323
```console
2424
sudo zypper install -y php php-cli php-fpm php-mysql php-xml php-mbstring php-opcache apache2
2525
```
26-
Package breakdown:
27-
| Package | Description |
28-
| ---------------- | ------------------------------------------------------------------------------------------------ |
29-
| **php** | Core PHP interpreter used to run web applications. |
30-
| **php-cli** | Enables running PHP scripts from the command line. Useful for testing and automation. |
31-
| **php-fpm** | FastCGI Process Manager — manages PHP worker processes and improves concurrency and performance. |
32-
| **php-mysql** | Provides MySQL/MariaDB database connectivity for PHP. |
33-
| **php-xml** | Adds support for parsing and manipulating XML data. |
34-
| **php-mbstring** | Adds multi-byte string handling, required by many web frameworks. |
35-
| **php-opcache** | Boosts performance by caching precompiled PHP bytecode in memory, reducing runtime overhead. |
36-
| **apache2** | Installs the Apache HTTP web server, which will serve PHP files via mod_php or FastCGI. |
26+
**Package breakdown:**
27+
- **php**: Core PHP interpreter used to run web applications.
28+
- **php-cli**: Enables running PHP scripts from the command line. Useful for testing and automation.
29+
- **php-fpm**: FastCGI Process Manager—manages PHP worker processes and improves concurrency and performance.
30+
- **php-mysql**: Provides MySQL/MariaDB database connectivity for PHP.
31+
- **php-xml**: Adds support for parsing and manipulating XML data.
32+
- **php-mbstring**: Adds multi-byte string handling, required by many web frameworks.
33+
- **php-opcache**: Boosts performance by caching precompiled PHP bytecode in memory, reducing runtime overhead.
34+
- **apache2**: Installs the Apache HTTP web server, which will serve PHP files via mod_php or FastCGI.
3735

3836

39-
### Enable and start Apache:
40-
Once Apache is installed, enable and start the service so that it runs automatically on boot and begins serving HTTP requests immediately:
37+
## Enable and start Apache
38+
After installing Apache, enable and start the service so it runs automatically on boot and begins serving HTTP requests:
4139
```console
4240
sudo systemctl enable apache2
4341
sudo systemctl start apache2
4442
sudo systemctl status apache2
4543
```
46-
If everything starts correctly, the output should look similar to:
44+
If everything starts correctly, the output is similar to:
4745

4846
```output
4947
● apache2.service - The Apache Webserver
@@ -65,17 +63,21 @@ Oct 15 18:55:30 pareena-php-test systemd[1]: Starting The Apache Webserver...
6563
Oct 15 18:55:30 pareena-php-test systemd[1]: Started The Apache Webserver.
6664
```
6765

68-
### Verify PHP installation
66+
## Verify PHP installation
6967
After installation, verify that PHP is installed correctly and view the installed version:
7068

7169
```console
7270
php -v
7371
```
74-
You should see output similar to:
72+
The output is similar to:
7573
```output
7674
PHP 8.0.30 (cli) (built: Nov 25 2024 12:00:00) ( NTS )
7775
Copyright (c) The PHP Group
7876
Zend Engine v4.0.30, Copyright (c) Zend Technologies
7977
with Zend OPcache v8.0.30, Copyright (c), by Zend Technologies
78+
79+
{{% notice success %}}
80+
PHP is installed and ready for use on your Arm-based SUSE VM.
81+
{{% /notice %}}
8082
```
8183
You can now proceed to the baseline testing section, where you’ll create and load a simple PHP web page to confirm that Apache and PHP are working together on your SUSE Arm-based virtual machine.

0 commit comments

Comments
 (0)