When I run:
composer global required “fxp/composer-asset-plugin:^1.3.1”,
It's report an error like this:
PHP Fatal error: Uncaught Error: Call to undefined method Composer\Package\RootPackage::getConfig()
Check your composer version is latest; if not, upgrade your composer.
Note: If you are in Ubuntu, and you use sudo apt install composer, plz remove it, install use curl or widget install again.
If your composer version is already the latest, plz use sudo
Use this:
sudo composer global require "fxp/composer-asset-plugin:^1.3.1"
Related
I have an issue with connecting php(valet) and MongoDB. I tried to install MongoDB with pecl and command sudo pecl install mongodb and brew install mongodb and all time I get some errors during the install process:
In file included from /private/tmp/pear/temp/mongodb/src/MongoDB/Cursor.c:18: /opt/homebrew/Cellar/php#8.0/8.0.17/include/php/ext/spl/spl_iterators.h:151:4: error: unknown type name 'pcre_cache_entry' pcre_cache_entry *pce; ^ 1 error generated. make: *** [src/MongoDB/Cursor.lo] Error 1 ERROR: make' failed`.
But when I run mongo --version I get:
and I install MongoDB Compass and as you can see, I can connect to the database and write into it:
But when I try out to install laravel package jenssegers/mongodb I get these errors: I tried with --ignore-platform-req=ext-mongodb flag but then it install package but it didn't work, I get this error: Error: Class "MongoDB\Driver\Manager" not found.
Finally, I find out a great package that helps me in this! This repo saves me a ton of time and debugging! Thank you shivammathur!
Hey I also had the same problem. A good alternative is to also follow with this article if you want to stick with pecl https://freek.dev/2151-fixing-the-dreaded-pcre2h-file-not-found-error-when-installing-imagick
When I am trying to intall Laravel to Ubuntu with the following command:
composer global require "laravel/installer"
I get the following error (see following image)
When I run:
php --ini
I get the following output (see following image)
I really cannot see what the problem is, all help i appreciated.
Thanks
I will give you one small tip, whenever any error occurs, kindly try reading through it.
As it says requires ext-zip that means it is require extension ZIP installed to perform required operation.
So all you need to do as of now is to install ZIP extension for php using this command
sudo apt-get install php7.0-zip
I have executed the following command on windows command prompt
folder path >php composer.phar install
Getting Error
Could not open input file: composer.phar
Your command is trying to use composer which is not installed. It is not used to install composer. You have to install it using one of methods stated here:
https://getcomposer.org/doc/00-intro.md
The other option is that your path to composer file is wrong, which can also be fixed by following documentation.
I am trying to install the yii framework. I already had a composer installed.
so i run the command to install composer assset plugin:
php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
the command runs for sometimes and gives an error:
Fatal error:Call to undefined method
composer\package\Loader\ArrayLoader::praseLinks<>
but, new project is created with:
php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.8
Try this
php composer.phar update
or else
php composer.phar self-update
Composer version is old. You will need to update composer.
Run the following command -
php composer.phar self-update
This should resolve the error
Sorry if this is trivial but I did not find any advice how to fix this.
I am on Ubuntu and need PHPUnit for my Yii project.
I have installed PHPUnit twice, by downloading and moving phpunit.phar to '/usr/local/bin' and by running:
composer global require "phpunit/phpunit=3.7.*"
Now I am trying to execute my Yii PHPUnit test:
phpunit unit/DbTest.php
And what I get is:
PHP Warning: require_once(PHPUnit/Extensions/SeleniumTestCase.php):
failed to open stream: No such file or directory in
/opt/lampp/htdocs/yii-project/framework/test/CWebTestCase.php on line 12
PHP Fatal error: require_once(): Failed opening required
'PHPUnit/Extensions/SeleniumTestCase.php'
(include_path='.:/usr/share/php:/usr/share/pear') in
/opt/lampp/htdocs/yii-project/framework/test/CWebTestCase.php on line 12
So it seems that it can't find PHPUnit extension SeleniumTestCase.php. Then PHPUnit installation manual states that Selenium 'is included in the PHAR distribution of PHPUnit.'.
Can you suggest what do I do to make my Yii test work?
You need to install optional additional packages of phpunit for Yii testing to run
The packages you would need are
PHP_Invoker
DbUnit
PHPUnit_Selenium
phpunit-story
You can install them using composer by adding the following to require-dev
"phpunit/php-invoker": "*",
"phpunit/dbunit": ">=1.2",
"phpunit/phpunit-selenium": ">=1.2",
"phpunit/phpunit-story": "*"
use the following commands to install the respective dependencies
composer global require 'phpunit/phpunit-selenium=*'
composer global require 'phpunit/phpunit-story=*'
composer global require 'phpunit/dbunit=*'
composer global require 'phpunit/php-invoker=*'
What I did to fix this:
1) I have downloaded selenium extensions from:
https://github.com/sebastianbergmann/phpunit-selenium/tree/master/PHPUnit/Extensions
and placed the entire PHPUnit directory under
/opt/lampp/htdocs/yii-project/framework/test
At that point PHPUnit stopped complaining about missing SeleniumTestCase.php.
2) Then I got an error about missing file in
PHPUnit/Runner/Version.php
To fix this I commented out these lines in CTestCase.php:
//require_once('PHPUnit/Runner/Version.php');
//require_once('PHPUnit/Util/Filesystem.php'); // workaround for PHPUnit <= 3.6.11
//require_once('PHPUnit/Autoload.php');
Now I am able to run my tests.
Here is what worked for me
sudo pear config-set auto_discover 1
sudo pear channel-discover pear.phpunit.de
sudo pear install --alldeps pear.phpunit.de/PHP_Invoker
sudo pear install --alldeps pear.phpunit.de/DbUnit
sudo pear install --alldeps pear.phpunit.de/PHPUnit_Selenium
sudo pear install --alldeps pear.phpunit.de/phpunit-story
In time of replying this, it is necessary to little bit amend Manquer's response. It is necessary to edit CWebTestCase and include Selenium2TestCase.php instead of SeleniumTestCase.php and extending PHPUnit_Extensions_Selenium2TestCase instead of PHPUnit_Extensions_SeleniumTestCase. Php-invoker is not possible to install on Windows and it is not necessary.