Reputation: 573
My website works perfect on localhost
but when moved to live server which is Ubuntu 16.04 LTS
I got this error
[Mon Mar 05 11:11:28.968821 2018] [:error] [pid 19322] [client 156.212.75.255:61635] PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in XXXXXXXXXX/vendor/symfony/finder/Comparator/NumberComparator.php on line 42 [Mon Mar 05 11:11:28.968895 2018] [:error] [pid 19322] [client 156.212.75.255:61635] PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0 [Mon Mar 05 11:11:28.969374 2018] [:error] [pid 19322] [client 156.212.75.255:61635] PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in XXXXXXXXXX/vendor/symfony/finder/Comparator/NumberComparator.php on line 42 [Mon Mar 05 11:11:28.969390 2018] [:error] [pid 19322] [client 156.212.75.255:61635] PHP Fatal error: Exception thrown without a stack frame in Unknown on line 0
How can I fix that and what is the right way to remove the public directory?
Upvotes: 1
Views: 3114
Reputation: 125
sudo a2dismod php7.0
sudo a2enmod php7.1 #to enable 7.1
sudo service apache2 restart
Upvotes: 4
Reputation: 1267
Check your php version, it's very likely that's it:
For ubuntu family:
> a2dismod php5.6 #current version
> a2enmod php7.1 #required version ( 7.0, 7.1, 7.2 )
> service apache2 restart
Upvotes: 1
Reputation: 573
follow this link to upgrade php version to 7.2
https://thishosting.rocks/install-php-on-ubuntu/
then run this commands
sudo a2enmod php7.2 sudo a2dismod php7.0
sudo service apache2 restart
Upvotes: 2
Reputation: 1674
If you look at the source code.
/**
* @param string|int $test A comparison string or an integer
*
* @throws \InvalidArgumentException If the test is not understood
*/
public function __construct(?string $test)
{
The ?string
, it's called Nullable
Type. This feature comes after php 7.1
(see documentation here). So you need to upgrade php version on your server. Make sure you get minimum php version 7.1
. Or make it same with your local environment.
Upvotes: 3