Some warnings from PHP 7.2
Hi,
I'm getting these warnings and errors:
PHP Warning: Unsupported declare 'strict_types'
PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)
It seems PHP 7 is not working propertly. Right now I have these two versions installed:
PHP 5.6 (ea-php56)
PHP 7.2 (ea-php72)
The System PHP Version is 5.6. From EasyApache the PHP7 version is 7.2.10-1.1.1.cpanel.
Any help is welcome.
Thanks!
-
Hi, That could be application specific error that you have reported. Please check if the application is supporting PHP 7 version or not. 0 -
Hi 24x7server, The application works fine with PHP 7.1 in the staging environment. According to these threads: PHP 7 - Unsupported declare 'strict_types' Error in Laravel vendor files: Warning: Unsupported declare 'strict_types' in Laravel 5.3 Apparently I need ext-mbstring but I installed "php72-php-mbstring Installed - 7.2.10-1.1.4.cpanel" with no success. And regarding to the second thread: Your servers web has PHP 7 enabled (if you took it from phpinfo();), but CLI of your server doesn't. The command you are trying to run is being run from console. CLI and WEB PHP versions are differn't things. If your server is Debian based (Ubuntu). Look into /etc/php and see if there are multiple PHP versions, if there are, you can make symbolic link to link your CLI version also to PHP 7 Any ideas? Thanks for your help, 0 -
I think it might be more helpful to call the version of PHP directly rather than use the system default (which is going to be the default version of php you have installed and can definitely be different than the account's php version) For example: /opt/cpanel/ea-php72/root/usr/bin/php --version PHP 7.2.11 (cli) (built: Oct 16 2018 16:06:54) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.4, Copyright (c) 2002-2018, by ionCube Ltd.
Are you getting the error when calling it through the browser or over CLI?0 -
After creating a new document root at /{username}/public I had a similar error. This one: PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'
I added the following lines to the bottom of Laravel's .htaccess to fix it.# php -- BEGIN cPanel-generated handler, do not edit # Set the "ea-php72" package as the default "PHP" programming language. AddType application/x-httpd-ea-php72 .php .php7 .phtml # php -- END cPanel-generated handler, do not edit0
Please sign in to leave a comment.
Comments
4 comments