LoginSignup
13
13

More than 3 years have passed since last update.

PHPのini_setについて

Posted at

PHPの設定をいじることができる。
php.iniほど多くのオプションを指定することは出来ない。

よく使いそうなエラー出力を中心にメモ。

display_errors

1(true)又は0(false)で、PHPエラーの画面表示・非表示を設定できる。

PHP
ini_set("display_errors", 1);
//エラーを画面に表示する

error_reporting

出力するエラーのレベルを設定する。
定義済み定数

PHP
ini_set("error_reporting",E_ALL);
//すべてのエラーを表示する

log_errors

"on"又は"off"で、エラーログを保存するかどうかを決める。
基本的には、保存先を指定するerror_logプロパティと併用する。

PHP
ini_set("log_errors","on");
//エラーを保存する。
ini_set("error_log","/log/error.log");
//エラーを/log/error.logに保存する。

error_log

エラーログの保存先を指定する。
上記のlog_errorsと併用する

PHP
ini_set("log_errors","on");
//エラーを保存する。
ini_set("error_log","/log/error.log");
//エラーを/log/error.logに保存する。

date.timezone

タイムゾーンを設定する。

PHP
ini_set("date.timezone", "Asia/Tokyo");
//タイムゾーンを東京にセット。

参考記事

13
13
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
13
13