Monday, November 14, 2016

PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE)

PHP Parse error:  syntax error, unexpected '$value' (T_VARIABLE)

If you are getting this error for specific php keywords used in code like yield, you need to upgrade your php version. May be you have php 5.4 or lower version, upgrade it to php 5.5 or php 5.6 or higher.

PHP Fatal error: Call to undefined function mb_strpos()


Solution :

php-mbstring package is not installed on your Linux distribution.

Install it.

If you are using Debian or Ubuntu
sudo apt-get install libapache2-mod-php5
If you are using Fedora or CentOS
yum install php-mbstring

Restart apache and try again.

date(): 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.

Set following value in php.ini file


date.timezone = 'Asia/Kolkata'

It depends on your timezone. Set your timezone in php.ini
You may face this error if this line is commented.

Restart Apache and try again.

SQLSTATE[HY000]: General error: 1364 Field doesn't have a default value

Solution :

Go on mysql prompt and run following command.


mysql> SET GLOBAL sql_mode=''

Make sure no value has been set for attribute sql_mode in the file my.cnf.