【PHP】PHP Deprecated: Comments starting with '#' are deprecated in /etc/php.ini on line xxx in Unknown on line 0
公開日時:2018年03月04日 / 最終更新日時:2019年02月11日
先日 PHP プログラムを実行した際に以下のエラーメッセージが出力されました。
[test@cent07 renshu]$ php preg_replace.php
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php.ini on line 478 in Unknown on line 0
|
/etc/php.ini にコメントアウトとして「#」を使っていることが原因
結論から言えば「/etc/php.ini」にコメントアウトとして「#」を使っていることが原因でした。
463 ; This directive controls whether or not and where PHP will output errors,
464 ; notices and warnings too. Error output is very useful during development, but
465 ; it could be very dangerous in production environments. Depending on the code
466 ; which is triggering the error, sensitive information could potentially leak
467 ; out of your application such as database usernames and passwords or worse.
468 ; It's recommended that errors be logged on production servers rather than
469 ; having the errors sent to STDOUT.
470 ; Possible Values:
471 ; Off = Do not display any errors
472 ; stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
473 ; On or stdout = Display errors to STDOUT
474 ; Default Value: On
475 ; Development Value: On
476 ; Production Value: Off
477 ; http://php.net/display-errors
478 #display_errors = Off ← コメントアウトで「#」を使っていた。
479 display_errors = On
480
|
/etc/php.ini のコメントアウトは「;」
「/etc/php.ini」でコメントアウトをする時は「;(セミコロン)」を使います。
→急いでいる時は結構やってしまうミスです。
; Possible Values:
; Off = Do not display any errors
; stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
; On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
;display_errors = Off ← 「;」に変更しました。
display_errors = On
|
Posted by 100%レンタルサーバーを使いこなすサイト管理人
Secured By miniOrange
コメントを残す