I got an 500 Internal Server Error and there is no error in php error log.
Below is my production php.ini running AWS EC2 instance (ubuntu 14.04, php 5.5.9, mysql 5.5.43). Yii2 is setup as production mode.
error_reporting = E_ALL & ~E_STRICT & ~E_DEPRECATED
log_errors = On
error_log = /var/log/php_errors.log
I did a test error log by doing error_log(‘test php error’). The message appears under /var/log/apache2/error.log . My first question is Why would it be in error.log and not /var/log/php_errors.log as I specified in the php.ini ? I already restart apache server. Do I have to manually create /var/log/php_errors.log first ? do I edit the wrong php.ini file ?
Later, I figure out the issue was I am trying to format demobilization_rate_billable as currency . the database field was supposed to be DECIMAL(11,2) NULL. But I had made a mistake and had it as DATE. So when Yii2 try to format it, it returns 500 Internal Server Error.
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'project_id',
'value' => function($model) {
return $model->project->name;
}
],
[
'attribute' => 'demobilization_rate_billable',
'format' => 'currency',
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
The strange thing is my development server ( running AMPPS on windows 7 , php 5.5 and Yii2 is setup in development mode) does not give me the error as all. It runs fine. Why is that ?