lubuntu-13.10-desktop-amd64.iso PHP エラーメッセージ | 乖離のぶろぐ(*´∀`)吸い込んで応援
(゚ω゚)前回の続き。
http://ameblo.jp/pochifx/entry-11796073326.html
lubuntu-13.10-desktop-amd64.iso PHP 基礎知識
2014-03-15

(゚ω゚)サンプルプログラムを見つけては、デバッグ

http://www.atmarkit.co.jp/fcoding/articles/php5/01/php501b.html
ベータリリース目前!? PHP5の新機能
小山 哲志
2003/4/25
このクラスは、$var1、$var2、$var3の3つのプロパティを持っている。$var1はprivateで宣言されており、$var2と$var3はprotectedだ。ここで、

$hoge = new Hoge1;
echo 'var1: ' . $hoge->var1 . "<br>\n";


として外部からのアクセスが許されないprivateなプロパティを参照してみると、

Fatal error: Cannot access private property hoge1::$var1 in /path/to/script.php on line XX

のようにエラーが発生する。protectedな$var2に対しても同様だ。

(゚ω゚)どこにエラーメッセージが出てくるのか?
(゚ω゚)これも xdebug.ini になにか書かないと表示しないのか?

lubuntu@lubuntu-VirtualBox:/etc/php5/mods-available$ pwd
/etc/php5/mods-available
lubuntu@lubuntu-VirtualBox:/etc/php5/mods-available$ ls -la
合計 24
drwxr-xr-x 2 root root 4096 3月 14 11:30 .
drwxr-xr-x 5 root root 4096 3月 12 12:25 ..
-rw-r--r-- 1 root root 83 3月 1 05:20 opcache.ini
-rw-r--r-- 1 root root 66 3月 1 05:20 pdo.ini
-rw-r--r-- 1 root root 76 3月 1 05:20 readline.ini
-rw-r--r-- 1 root root 71 3月 14 11:30 xdebug.ini
lubuntu@lubuntu-VirtualBox:/etc/php5/mods-available$ cat /etc/php5/mods-available/xdebug.ini
zend_extension=/usr/lib/php5/20121212/xdebug.so
xdebug.remote_enable=1
lubuntu@lubuntu-VirtualBox:/etc/php5/mods-available$


(゚ω゚)errorの設定を調べる・・・
lubuntu@lubuntu-VirtualBox:/etc/php5/mods-available$ php -i | grep error
disable_functions => pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, => pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
display_errors => Off => Off
display_startup_errors => Off => Off
error_append_string => no value => no value
error_log => no value => no value
error_prepend_string => no value => no value
error_reporting => 22527 => 22527
html_errors => Off => Off
ignore_repeated_errors => Off => Off
log_errors => On => On
log_errors_max_len => 1024 => 1024
track_errors => Off => Off
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
opcache.error_log => no value => no value
lubuntu@lubuntu-VirtualBox:/etc/php5/mods-available$




http://www.24w.jp/study_contents.php?bid=php&iid=php&sid=setting&cid=001
画面にエラーを表示する

PHP実行時に発生したエラー・警告内容を、HTML(ブラウザ)上に出力(表示)するかどうかの指定です。

php.ini、PHPソースの両方で指定可能です。

// エラー出力する場合
ini_set( 'display_errors', 1 );




(゚ω゚)ソースに、デバッグ用のコードを書きたくない場合は、
/etc/php5/cli/php.ini
480行目を、
display_errors = On
に変更する。アパッチの再起動( /etc/init.d/apache2 restart )は不要。

/etc/php5/apache2/php.ini
(゚ω゚)のファイルはPHPのデバックには今のところ無関係。
root@lubuntu-VirtualBox:/etc/php5/cli# pwd
/etc/php5/cli
root@lubuntu-VirtualBox:/etc/php5/cli# fgrep display_errors php.ini
; display_errors
display_errors = On
; separately from display_errors. PHP's default behavior is to suppress those
root@lubuntu-VirtualBox:/etc/php5/cli# php -i | grep display_errors
display_errors => STDOUT => STDOUT
PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
root@lubuntu-VirtualBox:/etc/php5/cli# diff php.ini.bak php.ini #比較 変更前 変更後
480c480
< display_errors = Off
---
> display_errors = On
root@lubuntu-VirtualBox:/etc/php5/cli#