I am using the follwoing turotiral to install behat and mink on my mountain lion macbook.
http://www.ifusio.com/blog/how-to-install-behat-mink-on-mac-osx
It all seems to go fine until you run the behat command , then I get the following error
PHP Fatal error: Class 'Symfony\Component\Console\Helper\ProgressHelper' not found in /Users/waseem/pear/share/pear/Symfony/Component/Console/Application.php on line 966
PHP Stack trace:
PHP 1. {main}() /Users/waseem/pear/bin/behat:0
PHP 2. Behat\Behat\Console\BehatApplication->__construct() /Users/waseem/pear/bin/behat:26
PHP 3. Symfony\Component\Console\Application->__construct() /Users/waseem/pear/share/pear/behat/src/Behat/Behat/Console/BehatApplication.php:32
PHP 4. Symfony\Component\Console\Application->getDefaultHelperSet() /Users/waseem/pear/share/pear/Symfony/Component/Console/Application.php:75
Fatal error: Class 'Symfony\Component\Console\Helper\ProgressHelper' not found in /Users/waseem/pear/share/pear/Symfony/Component/Console/Application.php on line 966
Call Stack:
0.0002 632656 1. {main}() /Users/waseem/pear/bin/behat:0
0.0036 1350424 2. Behat\Behat\Console\BehatApplication->__construct() /Users/waseem/pear/bin/behat:26
0.0036 1350504 3. Symfony\Component\Console\Application->__construct() /Users/waseem/pear/share/pear/behat/src/Behat/Behat/Console/BehatApplication.php:32
0.0036 1350816 4. Symfony\Component\Console\Application->getDefaultHelperSet() /Users/waseem/pear/share/pear/Symfony/Component/Console/Application.php:75
If i install it via the Github method it all seems fine , this is just bugging me why this happens . I don't have Symfony on the machine.
Maybe because I installed --alldeps ? I have tried uninstalling and trying again and same issue
Behat PEAR channel is not maintained anymore. Latest Behat versions (>=2.4) are not available there.
The best and easiest way to install Behat is to use composer. I'd recommend to follow the original docs. Pear method is not listed there anymore.
Thanks for that , however the only method i got to work for me on Mac OS X reliably and I tried on both snow lepoard and Mountain lion was using the .phar method of installing.
The composer method although it seems simpler kept producing errors when following the guide found at
http://docs.behat.org/cookbook/behat_and_mink.html
The error i got is below so I stuck to using the phar files.
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to parse file "/Users/waseem/Behat/vendor/behat/mink-extension/src/Behat/MinkExtension/services/sessions/selenium2.xml".
[InvalidArgumentException]
[ERROR 1840] Element '{http://symfony.com/schema/dic/services}parameter', attribute 'type': [facet 'enumeration'] The value 'integer' is not an element of the set {'collection', 'service', 'string', 'constant'}. (in /Users/waseem/Behat/ - line 20, column 0)
[ERROR 1824] Element '{http://symfony.com/schema/dic/services}parameter', attribute 'type': 'integer' is not a valid value of the atomic type '{http://symfony.com/schema/dic/services}parameter_type'. (in /Users/waseem/Behat/ - line 20, column 0)
Have a look at behat\autoload_map.php. This file substitutes for the Symfony autoloader when that file is not found. It contains an array that maps namespace\class to directory and file. With a few additions, you can get this version of Behat working.
If it is true, as others have stated, that the PEAR channel is no longer supported for Behat, you are on your own with this solution. Personally, I'll be looking into another method to keep my Behat installation up to date.
Related
I want to install laravel on my windows but getting below error
Using below command install laravel
composer create-project --prefer-dist laravel/laravel:^7.0 learning-app
But getting below error in command prompt after run the composer command
PHP Fatal error: Class UpdateHelper\ComposerPlugin contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (Composer\Plugin\PluginInterface::deactivate, Composer\Plugin\PluginInterface::uninstall) in C:\xampp\htdocs\vendor\kylekatarnls\update-helper\src\UpdateHelper\ComposerPlugin.php on line 11
Trying all the commands like composer update but not getting any success.
My php version PHP 7.3.27
Anyone have idea how to solve then let me know
You're trying to install the laravel framework locked at a version released more than 2 years ago, is there a reason for this?
Also, what is the version of your composer (run composer --version)? If you're at the version 2 try downgrading to v1 and try again with the same command, if you really want the 7.0 version of Laravel (or simply install the newest version of the framework).
after updating my mac to php 8 laravel app stopped working, this is the error I'm getting:
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 871
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 945
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 871
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/.../Sites/.../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 945
I've tried to fix the issue by investigating the code with no luck
THE SOLUTION
As explained here latest version of laravel 6, 7 and 8 has made changes required for php 8. all you have to do is:
1- add php 8 to your composer.json (I've kept v7.4 just in case production server does not support php 8 yet)
"php": "^7.4|^8.0",
2- to run composer update to update your laravel to the latest version
composer update
3- make sure update the following libraries since they exist in all laravel applications
PHP to php:^8.0
Faker to fakerphp/faker:^1.9.1
PHPUnit to phpunit/phpunit:^9.3
4- check for any other library which needs to be updated, contribute if they haven't supported php 8. but you should be good to go with most of the libraries since they have active contributors.
EXPLAINING THE PROBLEM
as described here
PHP 8 introduces several improvements in PHP type systems such as the introduction of Union Types, mixed type, and a few more.
With these changes, certain methods in Reflection API's
ReflectionParameter yield incorrect results.
In PHP 8, the following methods from ReflectionParameter class is
deprecated:
ReflectionParameter::getClass()
ReflectionParameter::isArray()
ReflectionParameter::isCallable()
ReflectionParamter::getType() is the recommended way to replace the
deprecated methods. This method is available in PHP 7.0 and later.
Check your php version in your virtual machine(xampp or server).
php --version
Is that version PHP 8 ? Am I right? That's the cause of the problem:
PHP 8 introduces several improvements in PHP type systems such as the introduction of Union Types, mixed type, and a few more.
With these changes, certain methods in Reflection API's ReflectionParameter yield incorrect results.
In PHP 8, the following methods from ReflectionParameter class is deprecated:
ReflectionParameter::getClass()
ReflectionParameter::isArray()
ReflectionParameter::isCallable()
ReflectionParamter::getType()
Downgrade your php version to 7.4 and your Laravel app works like a charm!
I had similar issue. But I had already run brew update and brew cleanup before I noticed the issue. What I did:
I noticed this error from brew cleanup:
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite heroku-node
I ran the commands:
brew link --overwrite composer
composer upgrade
composer update
That's what worked for me
If you're using valet you should do the followings:
Downgrade from php8+ to php7.4 valet isolate php#7.4
Then run composer update using valet valet composer update
I have PHP version-7.3 installed in my system and Laravel-5.8. When I tried to rub composer install or composer update on an old Project with Laravel-5.4 and PHP Version-5.6.4, I got this error shown below:
In Builder.php line 1229:
compact(): Undefined variable: operator
Script php artisan optimize handling the post-install-cmd event returned with error code 1
Then, when I tried to run the application, I got this error page as shown on the screen:
I tried to run:
php artisan cache:clear
and
composer update
but the problem is still there.
How do I get it resolved?
Thank you.
It looks like this issue was fixed in Laravel 5.5 according to this post: https://github.com/laravel/framework/issues/26936#issuecomment-449479336
Since Laravel 5.4 is no longer supported, your best option might be to upgrade. You can find a list of the currently supported versions here: https://laravel.com/docs/releases
The minimal upgrade that should still fix the error would be 5.4 to 5.5. The instructions can be found here: https://laravel.com/docs/5.5/upgrade#upgrade-5.5.0 (please note that support for 5.5 has also ended, but it might still fix your bug). This would also require you to switch the project to PHP 7.0.0 or greater.
If:
You can't upgrade for whatever business/team related reason and
Are sure that the Homestead box is running the correct version of PHP (7.2 or lower based on the answer given here) and yet
are still getting this error,
explicitly define the PHP version on the Homestead.yaml file. This should be done on the sites property as such (each is a new line, of course):
map: test.appp
/home/vagrant/code/test/public
php: "7.1"
After installing laravel we get an error:
Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE or '$' in C:\xampp\htdocs\laravel\public\index.php on line 50
Laravel 5.1 uses the ::class property to get string representations of a fully qualified classname. The error you're seeing is caused by this line
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
This language feature has been introduced in PHP 5.5 which is a requirement of Laravel 5.1. Your installed PHP version is probably older than 5.5. Try to update your PHP binary.
In case you are interested in why ::class is used, take a look at this answer
Same thing happened to me also. I found that web server was using my old PHP version 5. To solve it for me, I did this -
sudo a2dismod php5
sudo a2enmod php7.0
sudo service apache2 restart
Your php version is too low.
Try version 7.0 or later php.
Your PHP version on your Xampp is lower than 5.5.9 as specified in the Laravel 5.1 doc.
Simply uninstall your current Xampp software and download a fresh copy at Apache website with this specification 5.6.12 / PHP 5.6.12 .
Do not forget to collaborate with your host provider to ensure that your hosting account runs the required PHP version (>=5.5.9) during the deployment of your Laravel 5.1 app online.
I was facing the same error but error was in app/User.php line 10.
Actually, line 10 was ok but before line 10 I was missing some php syntax.
After correct the php syntax error It was fixed. So you have to check C:\xampp\htdocs\laravel\public\index.php on line 49 carefully I am sure there is something wrong. Just try to correct. It will be fixed.
When I run
composer.phar install
I get this error almost at the end of the installation, any ideas?
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/belendez/public_html/laravel/artisan on line 46
Parse error: syntax error, unexpected T_STRING in /home/belendez/public_html/laravel/artisan on line 46
Script php artisan optimize handling the post-install-cmd event returned with an error
I look into the suggested link and it appears that somehow in the middle of the installation it changes from 5.3 to 5.2! If I try to start installation using 5.2 it returns right a way: class 'Phar' not found. Any ideas?
It seems that issuing only a php command will pick up another version of the interpreter. Try to change all the references to php in your composer.phar file to the one you want actually to be executed (in your case it seems /opt/php53/bin/php).
You can confirm that by simply launching a php -v directly from the command line to see what version your server will pick up