1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rocky Linux 9】09.PHP設定

Last updated at Posted at 2023-02-28

PHP設定

WordPressなどのPHPで動作するシステムを動かすためにPHPをインストール・設定する

PHPインストール

dnf install php php-{bcmath,cli,common,devel,fpm,gd,intl,ldap,mbstring,mysqlnd,opcache,pdo,xml}

Apache設定

  • Apacheはpreforkではなくeventで動作するため、PHPはPHP-FPMにproxyにてUNIXソケット、もしくはfcgiに流すことになる
  • proxy_moduleproxy_fcgi_moduleを読み込ませる
/etc/httpd/conf.modules.d/00-proxy.conf
# This file configures all the proxy modules:
LoadModule proxy_module modules/mod_proxy.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

PHP設定

/etc/php.ini
[PHP]
zend.multibyte = On
zend.script_encoding = UTF-8
expose_php = Off
log_errors_max_len = 4096
html_errors = On
post_max_size = 32M
upload_max_filesize = 16M
auto_detect_line_endings = On

[Date]
date.timezone = "Asia/Tokyo"

[iconv]
iconv.internal_encoding = UTF-8

[Session]
session.use_only_cookies = 0
session.use_trans_sid = 1

[mbstring]
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = "ASCII,ISO-2022-JP-MS,UTF-8,CP51932,SJIS-win"
mbstring.http_output = pass
mbstring.encoding_translation = On
mbstring.detect_order = "ASCII,ISO-2022-JP-MS,UTF-8,CP51932,SJIS-win"
mbstring.substitute_character = none

PHP-FPM起動・自動起動

systemctl enable --now php-fpm
1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?