Cannot Composer Install with Symfony - PhpStorm - symfony

I had a problem with my Ubuntu so I needed to install back everything.
Nearly all is done but when I start a new project with Symfony on PhpStorm, and when I do a composer install or composer update in the terminal I have an error that I don't know how to treat.
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DOMDocument" from the global namespace.
Did you forget a "use" statement? in /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52
Stack trace:
#0 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(284): Symfony\Component\Config\Util\XmlUtils::loadFile('/var/www/html/E...', Array)
#1 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php(41): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->parseFileToDOM('/var/ww
w/html/E...')
#2 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php(57): Symfony\Component\DependencyInjection\Loader\XmlFileLoader->load('web.xm
l')
#3 /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php in /var/www/html/Eval2/vendor/symfony/symfony/src/Symfony/Component/
Config/Util/XmlUtils.php on line 52
I tried installing composer following this link
but I don't recall using such practice.
So I cannot move forward with my project because I can't get past composer... if anyone knows why and could give me a step-by-step approach that would be truly appreciated.
Thank you

PHP's DOMDocument library is not installed. You need to install it. Try -
sudo apt-get install php-dom

Related

Symfony deployment: error code 255 with composer install --no-dev

Here are the steps, I am following:
Cloning my repository from github
git clone https://github.com/EresDev/EresNoteSymfony.git .
Updating .env file with APP_ENV=prod
Then performing install
composer install --no-dev
I get following error:
.
.
.
- Installing symfony/translation (v4.2.4): Loading from cache
- Installing symfony/validator (v4.2.4): Loading from cache
- Installing symfony/yaml (v4.2.4): Loading from cache
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
Script #auto-scripts was called via post-install-cmd
However, it works fine if I just use composer install without --no-dev
What can I do to make it work with --no-dev
Please refer to repository to access code if required.
apparently you have somehow managed to turn error display off (or it's some default). I get a very distinct error message when I run composer install --no-dev (run with commit e722218...)
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "TwigBundle" from namespace "Symfony\Bundle\TwigBundle".
!! Did you forget a "use" statement for another namespace? in [path]/EresNoteSymfony/src/Kernel.php:23
!! Stack trace:
!! #0 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(424): App\Kernel->registerBundles()
!! #1 [path]/EresNoteSymfony/vendor/symfony/http-kernel/Kernel.php(130): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 [path]/EresNoteSymfony/vendor/symfony/framework-bundle/Console/Application.php(65): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 [path]/EresNoteSymfony/vendor/symfony/console/Application.php(145): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
!! #4 [path]/EresNoteSymfony/bin/console(38): Symfony\Component\Console\Application->run(Object(Symfony\Componen in [path]/EresNoteSymfony/src/Kernel.php on line 23
!!
you should somehow turn error display on ;o)
update:
your config/bundles.php:6 says:
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
which essentially says, the twigbundle is expected in prod as well as in dev. thus the error? (but anyway, the point still stands, that you should display errors when running on cli)
after you change that line in your bundles.php, you have to move your twig.yaml config into the dev/test folders, I suppose.

I am getting error when use start command in symfony

I am very new to Symfony. I have installed Symfony in my system with symfony demo command it's working fine. I installed in that folder already developed project code. when use php bin/console server:start 0.0.0.0:8000 this command I am getting error:
PHP Fatal error: Uncaught RuntimeException: The autoloader expected class "AppKernel" to be defined in file "/home/Desktop/commercetools-sunrise-php-master/vendor/composer/../../app/AppKernel.php". The file was found but the class was not in it, the class name or namespace probably has a typo. in /home/Desktop/commercetools-sunrise-php-master/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:223
Stack trace:#0 [internal function]: Symfony\Component\Debug\DebugClassLoader->loadClass('AppKernel')#1 /home/Desktop/commercetools-sunrise-php-master/bin/console(26): spl_autoload_call('AppKernel')#2 {main}
thrown in /home/Desktop/commercetools-sunrise-php-master/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php on line 223
Any one can help me. Thanks in advance.
There may be a corrupted generated PHP file. Try this :
composer run-script post-install-cmd

stange error with Behat and Mink on Sf2

I'm using Behat,mink in my Symfony2 project,so I follow those tutorials to make installation :
http://extensions.behat.org/symfony2/ , http://extensions.behat.org/symfony2/migrating_from_2.3_to_2.4.html
but when I run this command php behat.phar --init "#YouBundleName",I get this very strange error :
PHP Warning: require(Behat\MinkExtension\Extension): failed to open stream: No such file or directory in phar:///var/www/project/behat.phar/src/Behat/Behat /Extension/ExtensionManager.php on line 112
PHP Fatal error: require(): Failed opening required 'Behat\MinkExtension\Extension' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///var/www/project/behat.phar/src/Behat/Behat/Extension/ExtensionManager.php on line 112
I'm sure I installed the last version of behat and mink mentionned in the second link above and then I made php composer.phar unpdate and cache clear too,but still the same error?
I had the same problem. Forgot you need to install behat/mink-extension as well as behat/mink. For example you might need to run:
php composer.phar require behat/mink-extension:*
Worked for me.
By the way, looks like you got confused by the two installation methods, phar vs composer. I'd go with the composer route because it's easier to update and manage versions. This would mean running php bin/behat ... instead of php behat.phar ....

PHP Fatal error: Uncaught exception PharException with message manifest

while trying to install composer.phar through command line , got an error
PHP Fatal error: Uncaught exception 'PharException' with message manifest cannot be larger than 100 mb in phar
please support me to solve this problem, i am trying to installing symfony2.1
It appears you got a corrupted phar for some reason. Try downloading a new one from https://getcomposer.org/download/ - if the CLI instructions do not work out for you you can just download the last snapshot by hand from https://getcomposer.org/composer.phar

Apache Karaf 2.2.3, featuresBoot issue

Karaf 2.2.3 recently released and finally has a pre-bundled spring-jms feature. In order to make life easy I added it to the featuresBoot config property with the other defaults:
featuresBoot=config,ssh,management,spring-jms
However, when I start Karaf it behaves uncontrollably. Sometimes it will install on boot and other times it doesn't. When it doesn't auto-install I attempt to add it via the command line:
features:install spring-jms
And even that behaves wildly. See below:
karaf#root> features:install spring-jms
Error executing command: java.lang.IllegalArgumentException
karaf#root> features:install spring-jms
Error executing command: invalid entry size (expected 3293 but got 16823 bytes)
karaf#root> features:install spring-jms
Error executing command: Manifest not present in the first entry of the zip mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.aopalliance/1.0_5
karaf#root> features:install spring-jms
Refreshing bundles org.springframework.context.support (50)
Error executing command: Could not start bundle mvn:org.eclipse.jetty/jetty-client/7.4.5.v20110725 in feature(s) jetty-7.4.5.v20110725: Unresolved constraint in bundle org.eclipse.jetty.client [83]: Unable to resolve 83.0: missing requirement [83.0] package; (&(package=org.eclipse.jetty.http)(version>=7.4.0)(!(version>=8.0.0)))
karaf#root> features:install spring-jms
Refreshing bundles org.springframework.context.support (50)
Those are back-to-back executions of the install command. The last execution works.
Anyone else see this behavior? Or know how to correct it?
Tony,
First, make sure that you are using the correct version Java, I use jdk 1.6_24. When using this, with no other bundles installed (a fresh installation), it installs properly. If I were you I would:
1) try installing a fresh instance of Karaf,
2) copy your maven repository to a new location, and
3) run Karaf in a fresh installation,
4) install spring-jms again.
If that doesn't work, reply to this and let me know your environment, along with all of the exceptions generated in your karaf log file.
By any chance are you using a customized org.ops4j.pax.url.mvn.cfg? I am, and it has caused a huge boot-time race condition problem that led to features sporadically failing to load.
Take a look at https://issues.apache.org/jira/browse/KARAF-910 "Race between FeatureService and ConfigAdmin for resolving mvn: URLs?"

Resources