Skip to content

Commit 2703257

Browse files
authored
Merge pull request #2428 from pareenaverma/content_review
PHP Axion Tech review
2 parents 7a80f23 + 3522721 commit 2703257

File tree

6 files changed

+181
-80
lines changed

6 files changed

+181
-80
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
@@ -11,10 +11,10 @@ who_is_this_for: This is an introductory topic for software developers migrating
1111

1212

1313
learning_objectives:
14-
- Provision an Arm-based SUSE SLES virtual machine on Google Cloud (C4A with Axion processors)
14+
- Provision a SUSE SLES virtual machine on Google Cloud C4A (Arm-based Axion VM)
1515
- Install PHP on a SUSE Arm64 (C4A) instance
1616
- Validate PHP functionality with baseline HTTP server tests
17-
- Benchmark PHP performance using PHPBench on Arm64 (Aarch64) architecture
17+
- Benchmark PHP performance using PHPBench on Arm64 architecture
1818

1919

2020
prerequisites:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Getting started with PHP on Google Axion C4A (Arm Neoverse-V2)
2+
title: Get started with PHP on Google Axion C4A (Arm Neoverse V2)
33

44
weight: 2
55

@@ -8,7 +8,7 @@ layout: "learningpathall"
88

99
## Google Axion C4A Arm instances in Google Cloud
1010

11-
Google Axion C4A is a family of Arm-based virtual machines built on Google’s custom Axion CPU, which is based on Arm Neoverse-V2 cores. Designed for high-performance and energy-efficient computing, these virtual machines offer strong performance for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications.
11+
Google Axion C4A is a family of Arm-based virtual machines built on Google’s custom Axion CPU, which is based on Arm Neoverse V2 cores. Designed for high-performance and energy-efficient computing, these virtual machines offer strong performance for modern cloud workloads such as CI/CD pipelines, microservices, media processing, and general-purpose applications.
1212

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

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

Lines changed: 78 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,75 +8,127 @@ layout: learningpathall
88

99

1010
## Baseline Setup for PHP-FPM
11-
This section covers the installation and configuration of **PHP and Apache** on a SUSE Arm-based GCP VM. It includes setting up **PHP-FPM** with a Unix socket, verifying PHP functionality via a test page, and ensuring Apache and PHP-FPM work together correctly.
11+
This section guides you through configuring PHP-FPM (FastCGI Process Manager) on a SUSE Arm-based Google Cloud C4A virtual machine. You will prepare the PHP-FPM pool configuration, verify PHP's FastCGI setup, and later connect it to Apache to confirm end-to-end functionality.
1212

1313
### Configure the PHP-FPM Pool
1414

15-
**PHP-FPM:** A FastCGI Process Manager that runs PHP scripts efficiently, handling multiple requests separately from the web server for better performance and security.
15+
PHP-FPM (FastCGI Process Manager) runs PHP scripts in dedicated worker processes that are independent of the web server.
16+
This design improves performance, security, and fault isolation — especially useful on multi-core Arm-based processors like Google Cloud’s Axion C4A VMs.
1617

17-
A **pool** is basically a set of PHP worker processes that handle requests.
18+
A pool defines a group of PHP worker processes, each serving incoming FastCGI requests. Different applications or virtual hosts can use separate pools for better resource control.
1819

1920
### Copy the Default Configuration (if missing)
2021

21-
Run this command to create a working config file:
22+
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:
2223

2324
```console
2425
sudo cp /etc/php8/fpm/php-fpm.d/www.conf.default /etc/php8/fpm/php-fpm.d/www.conf
26+
sudo cp /etc/php8/fpm/php-fpm.conf.default /etc/php8/fpm/php-fpm.conf
2527
```
28+
These commands:
29+
Create a default pool configuration (www.conf) that controls how PHP-FPM spawns and manages worker processes.
30+
Restore the main FPM service configuration (php-fpm.conf) if it's missing.
2631

2732
### Edit the Configuration
2833

29-
Open the config file in a text editor:
34+
Open the PHP-FPM pool configuration file in a text editor:
3035

3136
```console
3237
sudo vi /etc/php8/fpm/php-fpm.d/www.conf
3338
```
3439

35-
Update the file to use a Unix socket:
40+
Locate the following line:
3641

37-
Find this line `; listen = 127.0.0.1:9000`. Replace it with these lines.
42+
```output
43+
listen = 127.0.0.1:9000
44+
```
45+
Replace it with the following configuration to use a Unix socket instead of a TCP port:
3846

39-
```ini
47+
```console
4048
listen = /run/php-fpm/www.sock
4149
listen.owner = wwwrun
4250
listen.group = www
4351
listen.mode = 0660
4452
```
45-
- `listen = /run/php-fpm/www.sock` → PHP will talk to Apache using a local “socket file” instead of a network port.
46-
- `listen.owner = wwwrun``wwwrun` is Apache’s default user on SUSE, so Apache can access the socket.
47-
- `listen.group = www` → sets the group to match Apache’s group.
48-
- `listen.mode = 0660` → gives read/write permission to both Apache and PHP-FPM.
53+
54+
Explanation of each directive:
55+
| Directive | Description |
56+
| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
57+
| 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. |
58+
| listen.owner = wwwrun | Sets the owner of the socket file to `wwwrun`, which is the default user that Apache runs as on SUSE systems. This ensures Apache has access to the socket. |
59+
| listen.group = www | Assigns the group ownership of the socket to `www`, aligning with Apache’s default process group for proper access control. |
60+
| 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. |
61+
4962

5063
### Start and Enable PHP-FPM
5164

52-
Restart PHP-FPM so it picks up the changes:
65+
After updating the configuration, restart the PHP-FPM service so it picks up the new settings:
5366

5467
```console
5568
sudo systemctl restart php-fpm
5669
```
70+
Then, verify that PHP-FPM is running:
71+
72+
```console
73+
sudo systemctl status php-fpm
74+
```
75+
76+
You should see output similar to:
77+
78+
```output
79+
● php-fpm.service - The PHP FastCGI Process Manager
80+
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
81+
Active: active (running) since Thu 2025-10-16 13:56:44 UTC; 7s ago
82+
Main PID: 19606 (php-fpm)
83+
Status: "Ready to handle connections"
84+
Tasks: 3
85+
CPU: 29ms
86+
CGroup: /system.slice/php-fpm.service
87+
├─ 19606 "php-fpm: master process (/etc/php8/fpm/php-fpm.conf)" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""
88+
├─ 19607 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
89+
└─ 19608 "php-fpm: pool www" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
90+
91+
Oct 16 13:56:44 pareena-php-test systemd[1]: Starting The PHP FastCGI Process Manager...
92+
Oct 16 13:56:44 pareena-php-test systemd[1]: Started The PHP FastCGI Process Manager.
93+
```
94+
PHP-FPM is now active and ready to process requests via its Unix socket (/run/php-fpm/www.sock).
95+
Next, you will configure Apache to communicate with PHP-FPM, allowing your server to process and serve dynamic PHP pages.
96+
97+
## Install the Apache PHP8 module
98+
If you prefer to have Apache handle PHP execution directly (instead of using PHP-FPM), you can install the Apache PHP 8 module, which integrates PHP into Apache using the `mod_php` interface:
99+
100+
```console
101+
sudo zypper install apache2-mod_php8
102+
```
103+
Once the module is installed, restart Apache to load the new configuration:
104+
105+
```console
106+
sudo systemctl restart apache2
107+
```
108+
Next, you will test PHP execution by creating a simple PHP page and verifying that Apache can correctly render dynamic content.
57109

58110
## Test PHP
59-
Now that PHP and Apache are installed, let’s verify that everything is working correctly.
111+
Now that PHP and Apache are installed, you can verify that everything is working correctly.
60112

61113
### Create a Test Page
62-
We will make a simple PHP file that shows details about the PHP setup.
114+
Create a simple PHP file that displays detailed information about your PHP installation:
63115

64116
```console
65117
echo "<?php phpinfo(); ?>" | sudo tee /srv/www/htdocs/info.php
66118
```
67-
This creates a file named **info.php** inside Apaches web root directory `(/srv/www/htdocs/)`. When you open this file in a browser, it will display the PHP configuration page.
119+
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 will display the PHP configuration page.
68120

69121
### Test from Inside the VM
70-
Run the following command:
122+
You can verify that PHP and Apache are communicating correctly by testing the web server locally using curl:
71123

72124
```console
73125
curl http://localhost/info.php
74126
```
75127
- `curl` fetches the page from the local Apache server.
76-
- If PHP is working, you’ll see a large block of HTML code as output.
77-
- This confirms that PHP is correctly connected with Apache.
128+
- If PHP is working, you will see a large block of HTML code as output. This is the rendered output of the phpinfo() function.
129+
- This confirms that Apache successfully passed the request to the PHP interpreter and returned the generated HTML response.
78130

79-
You should see an output similar to:
131+
You should see output similar to:
80132

81133
```output
82134
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
@@ -96,18 +148,20 @@ h1 {font-size: 150%;}
96148
h2 {font-size: 125%;}
97149
h2 a:link, h2 a:visited{color: inherit; background: inherit;}
98150
```
99-
Basically, it is the HTML output that confirms PHP is working.
151+
This long HTML output represents the PHP configuration page content.
100152

101153
### Test from Your Browser
102-
Now, let’s test it from outside the VM. Open a web browser on your local machine (Chrome, Firefox, Edge, etc.) and enter the following URL in the address bar:
154+
Now, let's verify that your PHP setup works correctly from outside the VM.
155+
Open a web browser on your local machine (such as Chrome, Firefox, or Edge) and enter the following URL in the address bar:
103156

104157
```console
105158
http://<YOUR_VM_PUBLIC_IP>/info.php
106159
```
107-
- Replace `<YOUR_VM_PUBLIC_IP>` with the public IP of your GCP VM.
160+
- Replace `<YOUR_VM_PUBLIC_IP>` with the public IP of your Google Cloud Axion VM.
108161

109162
If everything is set up correctly, you will see a PHP Info page in your browser. It looks like this:
110163

111164
![PHP-info page alt-text#center](images/php-web.png "Figure 1: PHP info")
112165

113-
This verifies the basic functionality of the PHP installation before proceeding to the benchmarking.
166+
Successfully loading the PHP Info page in your browser confirms that your PHP and Apache environment on Google Cloud C4A is configured and functioning properly.
167+
You are now ready to proceed to the benchmarking and performance testing phase.

0 commit comments

Comments
 (0)