我已经在 Centos 8 上安装了 Apache 2.4 和 PHP 7.4,它在 Google Cloud Platform 上运行。
阿帕奇:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
└─php-fpm.conf, php74-php-fpm.conf
Active: active (running) since Wed 2020-07-29 07:55:37 UTC; 41min ago
Docs: man:httpd.service(8)
Main PID: 20366 (httpd)
Status: "Total requests: 19; Idle/Busy workers 100/0;Requests/sec: 0.0076; Bytes served/sec: 63 B/sec"
Tasks: 278 (limit: 9312)
Memory: 35.4M
CGroup: /system.slice/httpd.service
├─20366 /usr/sbin/httpd -DFOREGROUND
├─20368 /usr/sbin/httpd -DFOREGROUND
├─20369 /usr/sbin/httpd -DFOREGROUND
├─20370 /usr/sbin/httpd -DFOREGROUND
├─20371 /usr/sbin/httpd -DFOREGROUND
└─20583 /usr/sbin/httpd -DFOREGROUND
Jul 29 07:55:37 test-app-devel1 systemd[1]: Stopped The Apache HTTP Server.
Jul 29 07:55:37 test-app-devel1 systemd[1]: Starting The Apache HTTP Server...
Jul 29 07:55:37 test-app-devel1 systemd[1]: Started The Apache HTTP Server.
Jul 29 07:55:37 test-app-devel1 httpd[20366]: Server configured, listening on: port 443, port 80
PHP的:
php --version
PHP 7.4.8 (cli) (built: Jul 9 2020 08:57:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies
直接使用php
命令运行 PHP 脚本没问题。问题是无法通过浏览器执行 PHP 文件。我收到此 503 错误:
服务不可用 由于维护停机或容量问题,服务器暂时无法满足您的请求。请稍后重试。
以下是来自 Apache 日志的一些当前条目:
xxx.xxx.xxx.xxx - - [29/Jul/2020:08:15:17 +0000] "GET /test.txt HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
xxx.xxx.xxx.xxx - - [29/Jul/2020:08:15:19 +0000] "GET /test.txt HTTP/1.1" 304 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
xxx.xxx.xxx.xxx - - [29/Jul/2020:08:15:32 +0000] "GET /ASF20thAnniversary.jpg HTTP/1.1" 200 72242 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
xxx.xxx.xxx.xxx - - [29/Jul/2020:08:15:41 +0000] "GET /phpinfo.php HTTP/1.1" 503 299 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
xxx.xxx.xxx.xxx - - [29/Jul/2020:08:16:01 +0000] "-" 408 - "-" "-"
txt 和 jpg 文件均已正确加载。但 php 文件却加载不了。如何修复此问题?