Framework: vendor/symfony/finder/Comparator/NumberComparator.ph Error

Created on 8 Feb 2018  路  7Comments  路  Source: laravel/framework

  • Laravel Version: 5.6
  • PHP Version: 7.1.13
  • Database Driver & Version:

Description:

PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/itee/server/blog/vendor/symfony/finder/Comparator/NumberComparator.php on line 42, referer: http://itee/blog/

Steps To Reproduce:

After installation when the public folder is viewed in the browser

Most helpful comment

for me, the CLi version of PHP was higher than that with apache was using. php -v shows 7.1.11 while phpinfo() showed 7.0.x

Solution

  • Disable the older php: sudo a2dismod php7.0
  • Enable the new version: sudo a2enmod php7.1
  • Restart apache: sudo systemctl restart apache2

All 7 comments

You need to have at least PHP 7.1 running on your server, not just your CLI

I am receiving this error even though i have 7.1 on both CLI and server. I just updated to 5.6 and haven't been able to get past this error since.

php -v returns: PHP 7.1.8 (cli)
phpinfo() returns: PHP Version 7.1.12-1+ubuntu16.04.1+deb.sury.org+1.

Please advise? Many thanks

I ran into the same issue,
previously I used php7.0-fpm, but solved after installing php7.2-fpm & switching all the config files for my virtual hosts
are you using php-fpm? if so, which version of php-fpm you are using?

Hey mate, thanks for the reply.

When i run service php7.2-fpm status it returns:

php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-02-11 00:49:52 UTC; 9h ago
Docs: man:php-fpm7.2(8)
Main PID: 3534 (php-fpm7.2)
Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 3
Memory: 14.1M
CPU: 2.060s
CGroup: /system.slice/php7.2-fpm.service
鈹溾攢3534 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)
鈹溾攢3538 php-fpm: pool www
鈹斺攢3539 php-fpm: pool www

Feb 11 00:49:52 homestead systemd[1]: Stopped The PHP 7.2 FastCGI Process Manager.
Feb 11 00:49:52 homestead systemd[1]: Starting The PHP 7.2 FastCGI Process Manager...
Feb 11 00:49:52 homestead systemd[1]: Started The PHP 7.2 FastCGI Process Manager.

But then if i also run service php7.0-fpm status it returns:

php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-02-11 00:49:52 UTC; 9h ago
Docs: man:php-fpm7.0(8)
Main PID: 3510 (php-fpm7.0)
Status: "Processes active: 0, idle: 2, Requests: 50, slow: 0, Traffic: 0req/sec"
Tasks: 3
Memory: 44.9M
CPU: 16.885s
CGroup: /system.slice/php7.0-fpm.service
鈹溾攢3510 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
鈹溾攢3514 php-fpm: pool www
鈹斺攢3515 php-fpm: pool www

Feb 11 00:49:52 homestead systemd[1]: Stopped The PHP 7.0 FastCGI Process Manager.
Feb 11 00:49:52 homestead systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Feb 11 00:49:52 homestead systemd[1]: Started The PHP 7.0 FastCGI Process Manager.

It seems both are installed and running. I am using Vagrant 2.0.1 and Homestead 7.

I'm new to using vagrant/homestead environment so not completely across all the configurations but could the fact that both are running be causing me issues?

Also interesting to note, when i run php -v from within my xampp htdocs folder i get 7.1, but if i ssh into vagrant and run php -v i get 7.2. And phpinfo() returns 7.1 when accessing from the browser, as mentioned previously.

I decided to give vagrant/homestead a go because setting up apache/php environments on mac was hard to manage, but it seems like the configurations are all over the place with vagrant/homestead too? Or is that how it is suppose to be?

Its worth mentioning that laravel 5.5 is working fine under this set up though, it's just 5.6 giving me grief.

Any insight you could provide would be much appreciated, cheers.

for me, the CLi version of PHP was higher than that with apache was using. php -v shows 7.1.11 while phpinfo() showed 7.0.x

Solution

  • Disable the older php: sudo a2dismod php7.0
  • Enable the new version: sudo a2enmod php7.1
  • Restart apache: sudo systemctl restart apache2

@aphoe Thank you SO MUCH! This solved my problem after searching for days!

Down grading php. laravel and symfony/translation and other symfony packages solved my problem.

Was this page helpful?
0 / 5 - 0 ratings