Class 'Symfony\Component\HttpFoundation\ParameterBag' not found - laravel-5

I'm getting the following error when I try to run php artisan on a clean install of Laravel 5.1.43 on a Vagrant box. I've listed the versions below.
PHP Fatal error: Class 'Symfony\Component\HttpFoundation\ParameterBag' not found in /var/www/vendor/symfony/http-foundation/Request.php on line 240
PHP Stack trace:
PHP 1. {main}() /var/www/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /var/www/artisan:36
PHP 3. Illuminate\Foundation\Console\Kernel->bootstrap() /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:105
PHP 4. Illuminate\Foundation\Application->bootstrapWith() /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
PHP 5. Illuminate\Foundation\Bootstrap\SetRequestForConsole->bootstrap() /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
PHP 6. Symfony\Component\HttpFoundation\Request::create() /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php:20
PHP 7. Symfony\Component\HttpFoundation\Request::createRequestFromFactory() /var/www/vendor/symfony/http-foundation/Request.php:398
PHP 8. Symfony\Component\HttpFoundation\Request->__construct() /var/www/vendor/symfony/http-foundation/Request.php:1943
PHP 9. Symfony\Component\HttpFoundation\Request->initialize() /var/www/vendor/symfony/http-foundation/Request.php:222
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Symfony\Component\HttpFoundation\ParameterBag' not found
Host machine:
macOS 10.13 17A365
Vagrant 2.0.0
Composer 1.5.2 2017-09-11 16:59:25
Vagrant box:
Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-132-generic x86_64)
PHP 5.6.31-6+ubuntu14.04.1+deb.sury.org+1 (cli) with Xdebug v2.5.5
If it is helpful, I can upload my Vagrantfile and install.sh files, and also my composer.json file.

This is due to a new bug with APFS and NFS. Refer to https://github.com/hashicorp/vagrant/issues/8788 for more information

Related

Using Laravel on php 7.0

I have installed Laravel 5.5 and I'm getting the same error, documentation says this:
PHP >= 7.0.0
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
I ran:
$ php artisan --version`
$ Laravel Framework 5.5.42
and I'm getting this error:
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE)
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)
Is the documentation wrong? I'm using: https://laravel.com/docs/5.5/installation#installing-laravel
My server can only use PHP 7.0. Not 7.1. Is there no way to run Laravel on 7 anymore?
I'm installing via composer.
Is there a way to download a compatible version with 7.0?
If you have PHP 5.5 (actually 5.5.9 or greater) you should use Laravel 5.2.
If you have PHP 7.0 you can use Laravel 5.5.
The error you mentioned is because you are using PHP 5.5 which does not support PHP 7 Null coalescing operator (??) and it is being used somewhere in Laravel code.
As you said your server supports PHP 7.0, you might have more than one PHP versions installed on your system. Check PHP version running php --version.
The issue could be that the command line version of PHP differs to the Apache version of PHP. Run php --version and verify that you're using PHP 7.0.0 or greater.
Laravel 5.5.* has no issues running on PHP 7.0.*. I currently have a project running Laravel 5.5.43 on PHP 7.0.15 and this issue does not occur.
If the command line version of PHP is not up to date or if you have access to multiple versions of PHP, you should contact your hosting provider for help. You may also be able to run a command similar to the following to see if you can access a different version of PHP:
locate bin/php
The above may give you an idea of the installation location. For example, I see three different versions of PHP installed, but the default version (/usr/bin/php) is 7.0.15:
/opt/cpanel/ea-php56/root/usr/bin/php
/opt/cpanel/ea-php70/root/usr/bin/php
/opt/cpanel/ea-php71/root/usr/bin/php
/usr/bin/php
It was an issue with the Symfony Translation stack, i had to disable for the moment, also i have downgraded the carbon package to make it work, not sure why. It has some php7.1 code.

Laravel - Error while running php artisan - with MAMP PRO

First steps with Laravel 5 on MacOSX running MAMP PRO stack.
php artisan
I got the following error:
[RuntimeException]
Error Output: PHP Warning:
require(/Users/../../bootstrap/../vendor/autoload.php): failed to open
stream: No such file or directory in
/Users/../../bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required
'/Users/../../bootstrap/../vendor/autoload.php' (include_p
ath='.:/Applications/MAMP/bin/php/php5.6.10/lib/php') in
/Users/../../bootstrap/autoload.php on line 17
It seems to be related with some bootstrap autoload and MAMP php binaries... But this is as far as I can understand this.
Can I have some advices please?
If I run composer update instead, I do get the same Fatal Error.
It seems you have give a wrong path,re install the laravel.
Thank you for your answers.
I had some issues with composer assets plugin. I have:
1) Remove the folder related to the composer assets plugin.
2) Reinstalled.
3) go to the root diretory of my laravel project.
4) run sudo composer install
Runned php artisan and all seems to be working as expected.
Thank you so much for your time.

Installed Laravel Framework and getting error when i install artisian with (php artisan migrate:install)

Installed Laravel Framework and getting Error when I install artisian with the below (php artisan migrate:install)
My PHP version is [PHP: 5.5.11]
Parse error: syntax error, unexpected '[' in E:\xampp\htdocs\laravel-testing\vendor\laravel\framework\src\Illuminate\Support\helpers.php on line 426
E:\xampp\htdocs>cd laravel-testing
E:\xampp\htdocs\laravel-testing>php artisan migrate:install
Parse error: **syntax error, unexpected '['** in E:\xampp\htdocs\laravel-testing\vendor\laravel\framework\src\Illuminate\Support\helpers.php on line 426
What may be the problem ?
I would suggest to remove older version of your php and set latest version in environment variable. Secondly I would recommend to read this article. It's definitely going to help you understand migration.
Make sure you have composer installed in the VM (Vagrant) if you are not using homestead (laravel specific vagrant dist)
I was getting the same error. Wondering why the PHP version would matter if the VM was using a single and correct PHP dist.
https://getcomposer.org/download/

Laravel upgrade to 4.2 - mcrypt extension required

I have problems when trying to update laravel 4.1 to 4.2.
I started that project on ubuntu, then got a new macbook pro and it looks like I'm missing something.
I'm using XAMPP 1.8.3
When I
composer update
I get the following error
Mcrypt PHP extension required.
Script php artisan clear-compiled handling the post-update-cmd event returned with an error
After few googling, found homebrew, then it's easy
brew install mcrypt
but I get the following warning
Warning: mcrypt-2.6.8 already installed
Any ideas?
Assuming your macbook pro is running Mavericks, the problem is most likely in your $PATH variable. The php command defaults to the built in php that ships with your mac. You can verify this by entering in terminal echo $PATH;
If it points to /usr/bin:/bin/usr/bin:/usr/local/bin then the problem is here because the native mac php does not include mcrypt. Add your XAMP PHP to your paths variable should solve the problem,
export PATH=$PATH:\path\to\xamp\bin\php5.ver\bin

PHP Fatal error: PHP Startup: apc_mmap: mmap failed: in Unknown on line 0

I am trying to get APC up and running for PHP (magento) but i have this weird problem which is bothering me. I have done my apc installation through the below command
pecl install apc
pecl/apc is already installed and is the same as the released version 3.1.13
and i have also added the configuration parameter in /etc/php.d/apc.ini as shown below
extension=apc.so
apc.enabled=1
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=100M
apc.stat=0
apc.optimization=0
apc.shm_segments=1
apc.enable_cli=1
apc.cache_by_default=1
apc.include_once_override=1
apc.shm_size=4
apc.mmap_file_mask = /tmp/apc.XXXXXX
Before i thought that maybe my configuration is messing up but when i removed every line in the apc.ini file but still i am getting the below error when executing php --ini
PHP Fatal error: PHP Startup: apc_mmap: mmap failed: in Unknown on line 0
Segmentation fault (core dumped)
Now i am really not sure what to do
My PHP version is 5.4
I have resolved this issue after experimenting with the different packages of APC. The tutorial which is out there can be quite confusing because every tutorial mentioning to install the APC with pecl might not work with PHP54.
So what you really need to do is get the correct package for the installation, in my case i issued the below command
yum install php54w-pecl-apc
Once i did that everything went smoothly. The apc.ini file was automatically got created with the basic configuration in location /etc/php.d
phpinfo had also listed the APC as configured.
My php version
php -v
PHP 5.4.11 (cli) (built: Jan 30 2013 18:05:25)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Resources