apt
とりあえず、全部入れる。
$ sudo apt install nginx mysql-server php7.0-intl php7.0-mbstring php7.0-curl php7.0-gd php7.0-json php7.0-mysql php-fpm php7.0-readline php7.0-xml php7.0-bz2 php7.0-mcrypt php7.0-zip
php-fpm
とりあえず、php-fpm が動くようにする。
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
# fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#}
を
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
こんな感じに。
php7.0-fpm.service で起動すると、/run/php/php7.0-fpm.sock が作られてこれで通信するので、それを教えてやるということ。
/var/www/html/ に適当な php ファイルを作って(<?php phpinfo(); とか)正常に表示されることを確認する。
php の設定
全体的に
/etc/php/7.0/fpm/php.ini と /etc/php/7.0/cli/php.ini を修正しておく。fpm に入っているのは当然 fpm 用、cli に入っているのは コマンドラインで php を使った時の設定。
元に戻せるよう sudo cp /etc/php/7.0/fpm/php.ini{,.orig} しておくと良いかも。
*** /etc/php/7.0/fpm/php.ini.orig 2018-03-01 16:16:33.918678611 +0900
--- /etc/php/7.0/fpm/php.ini 2018-03-01 16:52:45.529193985 +0900
***************
*** 365,371 ****
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
! max_execution_time = 30
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
--- 365,371 ----
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
! max_execution_time = 60
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
***************
*** 386,392 ****
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
! memory_limit = 128M
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
--- 386,392 ----
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
! memory_limit = 256M
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
***************
*** 653,659 ****
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
! post_max_size = 8M
; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
--- 653,659 ----
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
! post_max_size = 160M
; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
***************
*** 806,812 ****
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
! upload_max_filesize = 2M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
--- 806,812 ----
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
! upload_max_filesize = 128M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
***************
*** 921,927 ****
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
! ;date.timezone =
; http://php.net/date.default-latitude
;date.default_latitude = 31.7667
--- 921,927 ----
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
! date.timezone = Asia/Tokyo
; http://php.net/date.default-latitude
;date.default_latitude = 31.7667
***************
*** 1034,1044 ****
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
! mail.add_x_header = On
; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
! ;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog
--- 1034,1044 ----
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
! mail.add_x_header = Off
; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
! mail.log = /var/log/php/mail.log
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog
***************
*** 1436,1442 ****
; How many bytes to read from the file.
; http://php.net/session.entropy-length
! ;session.entropy_length = 32
; Specified here to create the session id.
; http://php.net/session.entropy-file
--- 1436,1442 ----
; How many bytes to read from the file.
; http://php.net/session.entropy-length
! session.entropy_length = 32
; Specified here to create the session id.
; http://php.net/session.entropy-file
***************
*** 1445,1451 ****
; If neither are found at compile time, the default is no entropy file.
; On windows, setting the entropy_length setting will activate the
; Windows random source (using the CryptoAPI)
! ;session.entropy_file = /dev/urandom
; Set to {nocache,private,public,} to determine HTTP caching aspects
; or leave this empty to avoid sending anti-caching headers.
--- 1445,1451 ----
; If neither are found at compile time, the default is no entropy file.
; On windows, setting the entropy_length setting will activate the
; Windows random source (using the CryptoAPI)
! session.entropy_file = /dev/urandom
; Set to {nocache,private,public,} to determine HTTP caching aspects
; or leave this empty to avoid sending anti-caching headers.
***************
*** 1476,1482 ****
; the hash extension. A list of available hashes is returned by the hash_algos()
; function.
; http://php.net/session.hash-function
! session.hash_function = 0
; Define how many bits are stored in each character when converting
; the binary hash data to something readable.
--- 1476,1482 ----
; the hash extension. A list of available hashes is returned by the hash_algos()
; function.
; http://php.net/session.hash-function
! session.hash_function = 1
; Define how many bits are stored in each character when converting
; the binary hash data to something readable.
*** /etc/php/7.0/cli/php.ini.orig 2018-03-01 16:35:12.447094610 +0900 --- /etc/php/7.0/cli/php.ini 2018-03-01 16:47:10.326475067 +0900 *************** *** 459,465 **** ; Development Value: On ; Production Value: Off ; http://php.net/display-errors ! display_errors = Off ; The display of errors which occur during PHP's startup sequence are handled ; separately from display_errors. PHP's default behavior is to suppress those --- 459,465 ---- ; Development Value: On ; Production Value: Off ; http://php.net/display-errors ! display_errors = stderr ; The display of errors which occur during PHP's startup sequence are handled ; separately from display_errors. PHP's default behavior is to suppress those *************** *** 565,571 **** ; empty. ; http://php.net/error-log ; Example: ! ;error_log = php_errors.log ; Log errors to syslog (Event Log on Windows). ;error_log = syslog --- 565,571 ---- ; empty. ; http://php.net/error-log ; Example: ! error_log = /var/log/php/errors.log ; Log errors to syslog (Event Log on Windows). ;error_log = syslog *************** *** 921,927 **** [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone ! ;date.timezone = ; http://php.net/date.default-latitude ;date.default_latitude = 31.7667 --- 921,927 ---- [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone ! date.timezone = Asia/Tokyo ; http://php.net/date.default-latitude ;date.default_latitude = 31.7667 *************** *** 1034,1044 **** ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename ! mail.add_x_header = On ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ! ;mail.log = ; Log mail to syslog (Event Log on Windows). ;mail.log = syslog --- 1034,1044 ---- ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename ! mail.add_x_header = Off ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ! mail.log = /var/log/php/mail.log ; Log mail to syslog (Event Log on Windows). ;mail.log = syslog
mbstring
mbstring.language = Japanese mbstring.detect_order = UTF-8,SJIS,EUC-JP,JIS,ASCII mbstring.substitute_character = none mbstring.func_overload = 0 mbstring.strict_detection = Off


コメント