Installing annotations in composer - symfony

I used composer to install pimcore. Right now I am attempting to add routing for a new theme I'm using, but I reach a routing error. Based on symfony's documentation I realized I need to run composer require annotations but I get hit with this error:
[InvalidArgumentException]
Could not find package annotations.
Did you mean one of these?
minime/annotations
zeptech/annotations
ray/di
jms/metadata
jms/aop-bundle
after some looking around, I see that I first need to run composer require sensio/framework-extra-bundle. However, when I run it, after some time, I get hit with
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 2929729536) (tried to allocate 4096 bytes) in
phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129
Fatal error: Out of memory (allocated 2929729536) (tried to allocate 4096 bytes) in
phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 129
I'm realizing this is a memory issue, there are currently 3GB of memory on the server (running via DigitalOcean). What are my options? Running Ubuntu 16.04 btw.
I should add that my memory limit in php.ini is set to -1.

That is because PHP is running with a memory limit by default. You can by-pass it by running the following command.
php -d memory_limit=-1 /usr/local/bin/composer install
Another option would be updating your php.ini files and setting the memory_limit = -1.

Update: I solved it by running
/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=4096
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
to add 4 GB of memory from the hard drive.
Then I just run my command and it updated the framework with no problem. Hope this helps someone

Related

Getting Error on composer run to install modules "VirtualAlloc"

Getting this error on "composer require drupal/module-name".
I want to install a module on my drupal site but it always returns me this error.
VirtualAlloc() failed: [0x00000008] Not enough memory resources are available to process this command.
VirtualFree() failed: [0x000001e7] Attempt to access invalid address.
VirtualAlloc() failed: [0x00000008] Not enough memory resources are available to process this command.
VirtualFree() failed: [0x000001e7] Attempt to access invalid address.
Fatal error: Out of memory (allocated 1711276032) (tried to allocate 4096 bytes) in
phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on
line 223
Update on your php.ini file's: memory_limit= XXXM
Replace XXXM value by the memory that you wanna allocate.
Or replace XXXM by -1 to negate memory limit condition.
Virtual memory Error on composer run Solution (Windows)
Download PHP 7.3+ and place on a folder on c drive
Change the environment variable path of PHP to new php
Set the memory limit to -1 in PHP 7.3+ ini file Also uncomment the required extensions.
Run Composer

Symfony 4 - php bin/console server:run not works

I have a problem with this command : php bin/console server:run on Symfony 4
When I go to http://127.0.0.1:8000/ I have this error message :
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'J:\my_project\vendor\symfony\web-server-bundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0
Indeed, the router.php file does not exist !
But if I run this command : php -S 127.0.0.1:8000 -t public everything is ok.
Any idea ?
First check that you have installed the SF4 Web Server bundle :
> composer require server --dev
then you can start using it through Symfony using run / start command
Not sure if this is the case for you too, but it is probably worth checking (and may also be interesting for others having the same problem).
My antivirus software likes to put the router.php in quarantine (effectively removing it from that directory). Check if yours did the same and if so restore it and create an exception for that file. Additionally you should configure your antivirus to notify you if it puts something in quarantine, so you can intervene in time.

OutOfMemoryException symfony 3

I am running Symfony3 with Doctrine and Sonata Admin. I don't think I need to get into details about the project. The problem is that while I am editing one of my big entities I get an:
HTTP ERROR 500
When I cut down some properties of the Entity, I get an:
OutOfMemoryException in FileProfilerStorage.php line 158:
Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 5371354 bytes)
Tried:
1. Out of memory error in symfony failed
2. Changing php.ini memory_limit from 128M to 4048M (Step by step, I know it is too much), everything failed
3. php -d memory_limit=1024M app/console cache:clear --env=prod, various values, failed
4. also php bin/console cache:clear failed
Then, what's next?

Symfony2 Bootstrap.php.cache

I'm developing in Ubuntu 14 and I get the following error when creating a databaes:
$ php app/console doctrine:database:create
This is the error output:
PHP Warning: require_once(/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache):
failed to open stream: No such file or directory in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
PHP Fatal error: require_once(): Failed opening required
'/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache'
(include_path='.:/usr/share/php:/usr/share/pear') in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
What Ive Tried
Running this in Vagrant
Running this Locally
This is one among several problem running Symfony2 under Ubuntu, the other forcing you to implement umask(0000) otherwise you have to get chmod +a permissions for log and cache folders, this seems like a bit of a hassle for something seemingly simple.
Does anyone know what to work around this error?
This should do the trick:
php /home/jesse/playground/www/symfony/htdocs/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

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