PHP error after laravel installation - php

I would like to use laravel for my php project. I use WampServer2.2 (php 5.3.8 and Apache 2.2.21) on Windows 8.1. But after all kind of installation I tried (via composer or downloading the zip), when I get to the public folder in my browser I get PHP errors as :
Parse error: syntax error, unexpected '[' in C:\wamp\www\spi\laravel-master\vendor\laravel\framework\src\Illuminate\Support\helpers.php on line 411
or
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\wamp\www\spi\laravel-master\bootstrap\compiled.php on line 506
What may be the problem?

You say that your php version is 5.3.8 and the laravel docs say that 5.4 is required. The latest version(2.5) of WampServer comes with php 5.5.

upgrade PHP to PHP 5.6
You can use this command for local development server
php artisan serve

Related

How to fix PHP Parse error: syntax error, unexpected '?' in vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 500

Everything is working perfectly but on running I get this error
PHP Parse error: syntax error, unexpected '?' in htdocs\example\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 500
on line 500
return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null);
The ?? operator was introduced in php 7. You should upgrade your php version to the one required by the laravel version you are using.
Just upgrade the php version into PHP 7.1 (ea-php71) on cpanel using MultiPHP Manager .
It seems your php is lower than version 7.1.3, you need to have version above that. try to run phpinfo(). Hope it helps

Laravel error after changing php version

I just setup php 7.0.27 in both webserver and cli. My laravel project was working just fine before in php 7.2. When I try run command php artisan serve it shows an error:
PHP Parse error: syntax error, unexpected '?', expecting variable
(T_VARIABLE) in /var/www/html/pmanager/pmanager/vendor/symfony/console
/Output/Output.php on line 40
I followed this github discussion which says that the solution is installing same versions in cli and webserver, which, in my case is fine. I have 7.0.27 in both.
Another thing they are pointing it out is laravel shows this error with php 7.0. I cannot change my php version to 7.1 or 7.2 because I must stick with it so as to run magento 2.1 projects.
Any help without changing php version would be highly appreciated.
you can downgrade your laravel 5.6 project to 5.5!!
Changing the value of the Laravel version inside the composer.json file to the laravel 5.5.
Delete /vendor folder and run composer install

PHP Parse error: syntax error, unexpected '?' - laravel

I'm using laravel 5.5 framework.It requirements PHP >= 7.0.0.
when I run server I got this error (php artisan serve):
PHP Parse error: syntax error, unexpected '?' in E:\xampp\htdocs\dibit\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 233
I've installed the last version of xampp and phpstorm.
I think this error show I'm not using php 7.
in my console of my phpstorm when I run this commend:
php -v
it returns PHP 5.6.21.
where is my problem?
the result of this code:
<?php
echo phpversion();
?>
is:
7.2.1
http://localhost/p.php
I have two xampp software but them have been installed an
It looks to me like your command prompt uses an old php version. To confirm that, run
where php
in a command prompt and find out whether it prints the right path (to PHP7). If it's incorrect, check the PATH environment variable and modify it with the correct path to PHP7.
Hope it helps.

update from php 5.4.x to 5.5.38 still can't use doctrine/common

My system is using ubuntu 12.10 and apache 2.2.22 and using doctrince 2.4.
I updated my Php from 5.4.x to 5.5.38.
But i still countered this error:
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) in /var/www/xxxxxx/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php on line 62
At first, i thought it was my php 5.4 caused and then i updated php to 5.5.38.
Yet i still get this error.
I really have no idea how to fix it.
I can't update Ubuntu's packages from outside of the server.
Please someone help me.

Parse PHP SDK version requirement

I don't see it anywhere in the documentation or ReadMe but what is the PHP version requirements for the Parse PHP SDK?
I am running PHP Version 5.3.2-1ubuntu4.22, this is a Virtual Machine running Ubuntu. And I get the following error:
Parse error: syntax error, unexpected '[' in /vagrant/www_root/vendor/parse/php-sdk/src/Parse/ParseObject.php on line 317
I guess the Parse SDK requires PHP 5.4 with support for short array syntax.
That error is definitely a version issue. That code requires requires PHP 5.4+ but you are running PHP 5.3.
But you can fix this but changing that code to:
if (!is_array($value)) {
$value = array($value);
}

Categories