yii2 migration command shows "Out of memory" error - php

When I call yii2 migrate command(from console). I always get "Out of memory" message. In regular case php do not show this error, but when migration command.
# ./yii migrate
Yii Migration Tool (based on Yii v2.0.13-dev)
Out of memory
However PHP through Apache works absolutely fine. It's just on the CLI that I get this error. The machine is running CentOS release 6 and PHP 5.6. System memory is 6GB, that is enough to run command.
total used free shared buffers cached
Mem: 5971 1557 4413 128 119 440
-/+ buffers/cache: 998 4973
Swap: 0 0 0
Add:
I witnessed laravel artisan command also show that error.
I could not know what occurs this error finally. But when I re-installed php library from base, the error disappeared. This may help for you.

Related

EasyApache 4 Frozen on Loading profiles

Cpanel - Centos 7.8
Update
Running dcrpm provides this error message:
2020-07-08 14:21:51,147 ERROR [rpmutil.kill_spinning_rpm_query_processes]: Found stale rpm process: (7042) /usr/bin/rpm -q --nodigest --nosignature --queryforma
2020-07-08 14:21:51,505 ERROR [dcrpm.run]: DB needs recovery
2020-07-08 14:21:55,982 WARNING [rpmutil.verify_tables]: Skipping table 'Obsolet ename', blacklisted
yum commands dont return anything and rebuilding the RPM database doesn't seem to change anything.
I seem to be having some issues with EasyApache 4 after loading a few PHP extensions on a custom profile. I can no longer load any of the profiles.
I am stuck on an infinite loop of Loading profiles ... & when trying to access PHP versions through MultiPHP manager Gathering PHP-FPM packages information ... again in an infinite loop. Not quite sure how I've screwed up this time.
All I wanted to do was enable Zip Archives. Is there a way to disable what was enabled without going through there? Or is there a way to remove that profile and the associated enabled extensions?
Apologies I am somewhat of a newbie to all of this so I have come to the community that has helped me endlessly as I learn webdesign and basic code
All I can see in the error log is:
*AH01630: client denied by server configuration: /home/X/public_html/php.ini**
More Information
After leaving it load for an hour or so this appeared:
*The YUM cache is incomplete. The system is updating the cache to repair the issue.*
*This operation can take a few minutes to complete (it is very network and disk i/o intensive). EasyApache 4 will be available as soon as possible ...*
The result of which after several hours was:
*YUM encountered errors outside of EasyApache 4. Log into the system via SSH to resolve them, or you can click the ‘Refresh’ button to rebuild the system‘s YUM cache.*
Note: One new plugin was also installed recently (Softaculous) which may have something to do with it as the manage plugin section also doesn't load ._.
Unfortunately it seems now that no yum commands are working. I did try to run the following with no result:
yum clean all
yum update
It appears the proverbial ship is sinking, I can't even access plugins now as i get the follow fatal error:
(XID gvtyx9) The system aborted the subprocess “/bin/rpm” (process ID “23078”) because it reached the timeout of 15 seconds. at /usr/local/cpanel/Cpanel/SafeRun/Object.pm line 546.
Cpanel::SafeRun::Object::die\_if\_error(Cpanel::SafeRun::Object=HASH(0x2a1a970)) called at /usr/local/cpanel/Cpanel/SafeRun/Object.pm line 538
Cpanel::SafeRun::Object::new\_or\_die("Cpanel::SafeRun::Object", "program", "/bin/rpm", "args", ARRAY(0x179bed0), "timeout", 15, "read\_timeout", ...) called at /usr/local/cpanel/Cpanel/GenSysInfo.pm line 264
Cpanel::GenSysInfo::\_run\_with\_timeout("/bin/rpm", "--query", "--nosignature", "--nodigest", "--queryformat", "%{NAME} %{VERSION}\\\\n", "--file", "/etc/redhat-release") called at /usr/local/cpanel/Cpanel/GenSysInfo.pm line 204
Cpanel::GenSysInfo::\_get\_rpm\_distro\_version\_arch() called at /usr/local/cpanel/Cpanel/GenSysInfo.pm line 124
Cpanel::GenSysInfo::\_get\_new\_conf(HASH(0x2148000)) called at /usr/local/cpanel/Cpanel/GenSysInfo.pm line 51
Cpanel::GenSysInfo::run() called at /usr/local/cpanel/Cpanel/GenSysInfo.pm line 71
Cpanel::GenSysInfo::get\_rpm\_distro\_version() called at /usr/local/cpanel/Cpanel/Plugins.pm line 181
Cpanel::Plugins::\_do\_url\_variable\_substitution("[http://httpupdate.cpanel.net/cpanel-plugins-c\\$cp\_centos\_major](http://httpupdate.cpanel.net/cpanel-plugins-c\$cp_centos_major)"...) called at /usr/local/cpanel/Cpanel/Plugins.pm line 158
Cpanel::Plugins::get\_baseurls() called at /usr/local/cpanel/Whostmgr/Addons/RPM/Cache.pm line 170
Whostmgr::Addons::RPM::Cache::\_yum\_modules() called at /usr/local/cpanel/Whostmgr/Addons/RPM/Cache.pm line 102
Whostmgr::Addons::RPM::Cache::\_LOAD\_FRESH("Whostmgr::Addons::RPM::Cache") called at /usr/local/cpanel/Cpanel/CacheFile.pm line 234
Cpanel::CacheFile::load("Whostmgr::Addons::RPM::Cache") called at /usr/local/cpanel/Whostmgr/Addons/RPM/Cache.pm line 91
Whostmgr::Addons::RPM::Cache::load("Whostmgr::Addons::RPM::Cache") called at /usr/local/cpanel/Whostmgr/Addons/RPM.pm line 62
Whostmgr::Addons::RPM::get\_modules() called at whostmgr/bin/whostmgr2.pl line 2531
main::manage\_plugins("manage\_plugins") called at /usr/local/cpanel/Whostmgr/Dispatch.pm line 274
Whostmgr::Dispatch::\_do\_call("manage\_plugins", HASH(0x2145770), HASH(0x214a890)) called at /usr/local/cpanel/Whostmgr/Dispatch.pm line 172
Whostmgr::Dispatch::dispatch("manage\_plugins", 1, ARRAY(0x2147af8), HASH(0x214a890)) called at whostmgr/bin/whostmgr2.pl line 773

Magento2 catalog:images:resize mysql

I am getting the following error upon running bin/magento catalog:images:resize
300/973 [========>-------------------] 30% 7 mins 100.0 MiB | /1/2/12033_1.jpg
Warning: Error while sending QUERY packet. PID=17518 in ./vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228
I am currently running Magento 2.3.0 on PHP 7.1
Does anybody have an advice?
you need to increase the max allow packet in /etc/my.cnf add:
max_allowed_packet=32M
you can further increase it.

Can't run php artisan commands on laravel

I searched everywhere but i really can't find anything. I am trying to run php artisan but it seems that it just doesn't work.
Specifically i run this command when i am connected through ssh :
/opt/cpanel/ea-php71/root/usr/bin/php artisan
It is the same with php artisan but i am choosing a specific php version (7.1.5). This command should normally show up the rest of artisan commands.
The error i get :
PHP Fatal error: Allowed memory size of 2097152 bytes exhausted
(tried to allocate 4096 bytes) in
/home/username/laravel/vendor/composer/autoload_static.php on line
274
My hosting provider tried to increase the memory limit but nothing happened. I tried increasing it a lot through .php files too.
Also i have tried running composer install/update/clear cache/dump autoload.
Please ask for further information if needed,
Any ideas?
Try to check spelling in the php.ini file. That happened to me when I set memory_limit = 512MB (that is false) instead of memory_limit = 512M (wich is correct). For some reason php understood it as 2MB of memory.

ContextErrorException in DebugClassLoader.php with ParameterBag class

I'm using Symfony 2 and working with wamp server. After some time, i cannot access my pages anymore with that exception always showing, can't figuring why.
Here's the full stack trace :
in DebugClassLoader.php line 203
at DebugClassLoader->loadClass('Symfony\\Component\\HttpFoundation\\ParameterBag')
at spl_autoload_call('Symfony\\Component\\HttpFoundation\\ParameterBag') in Request.php line 240
at Request->initialize(array(), array(), array(), array(), array(), array([...]), null) in Request.php line 222
at Request->__construct(array(), array(), array(), array(), array(), array([...]), null) in Request.php line 1964
at Request::createRequestFromFactory(array(), array(), array(), array(), array(), array([...])) in Request.php line 281
at Request::createFromGlobals() in app_dev.php line 27
It seems the "DebugClassLoader" class is using reflection to analyze what's wrong and it throws an exception when getting to the ParameterBag class. A var_dump() shows that ParameterBag is implementing \IteratorAggregate and \Countable as expected but also some random class "o" which i can't figure where it comes from.
Prod environment will be an apache server running on a debian, maybe it will work on it but I'd better fix this on my current environment before going live.
All the code I have which may deal with ParameterBag is something like that :
$session = $request->getSession();
$session_id = $session->getId();
$webclient = $em->getRepository('AppBundle\Entity\WebClient')
->findOneBy(array("session_id" => $session_id));
...
Also note that clearing the cache does not fix this issue. (using php bin/console cache:clear [--env=dev])
PS: restarting apache fixes it, but it shows again later
I had that problem (not on ParameterBag but same exception in the same file), it was caused by a corrupted installation of APC. Try putting this line in your php.ini :
apc.cache_by_default = 0
In the [APC] block. If the error is gone for good, consider removing and reinstalling APC.
APC was not enabled. I tried to find if any other cache was installed to disable them but there was not. It still occurs on my dev environment.
However it does not seem to happen on my prod environment. I'll probably work with it.
If you while debugging try to clear server cache. You will face some error like:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 2444952 bytes) in C:\xampp\htdocs\project_name\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php on line 163
so to solve this issue you need to add below line in your php.ini and restart apache.
apc.cache_by_default = 0
Now see the magic. It will work fine.
thanks,
Anirudh Sood.
Update PHP version and restart the apache server.
To quote:
Currently, there are three supported versions of PHP i.e Versions 5.6, 7.0, 7.1and 7.2. As a modern-day web developer who works on different frameworks, packages need to have the multiple versions of PHP installed on your VPS.
During your development, not all your projects may support the latest version (V. 7.2) resulting you to downgrade to a much earlier version. In this tutorial, we will illustrate how to switch between the different versions of PHP from 7.2 to 7.0 to enable you to run your projects smoothly.

paypal adaptive accounts installation difficulties

I am trying to install paypal adaptive accounts API using PHP.
I have set up the developer account, test accounts and app and tested the parameters via the paypal tool. Now I need to install the API on our test site.
I have used How to check if curlSSL is working properly
to ensure I have curl set up.
I followed the instructions here using the PHP tab. I am installing without composer so I connected via an SSL client and used the command as instructed.
curl
https://raw.github.com/paypal/adaptiveaccounts-sdk-php/stable-php5.3/samples/install.php
| php
However I think this repository has been moved and I tracked it down to here.
Meaning my command should be
curl
https://raw.githubusercontent.com/paypal/adaptiveaccounts-sdk-php/master/samples/install.php
| php
I may have found the wrong code because it will not install.
The error output is
composer not installed or 'useComposer' is set to false in install.php.
Running custom installation ...
Downloading adaptiveaccounts-sdk-php - v2.6.106
Downloading sdk-core-php - v1.4.3
Generating autoload file
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 71 bytes) in - on line 340
I have checked the install file and the following lines
// Flag to control whether composer should be used for installation
$useComposer = false;
confirm that useComposer is set to false which makes me think I have found the wrong install file.
So does anyone know where the correct location is to point cURL?
Or am I doing anything else wrong? Note the install appears to try to run "custom installation" and fails with a memory error.
Part of this is solved. The install.php file had been removed accidentally .
So you can run
curl -k -L https://raw.github.com/paypal/adaptiveaccounts-sdk-php/stable-php5.3/samples/install.php | php
This gave me a further error
This install script only suppoorts namespace based SDK
So I was directed to a non-namespaced version of of the SDK
curl -k -L https://raw.github.com/paypal/adaptiveaccounts-sdk-php/blob/stable/samples/install.php | php
I then started to get
Fatal error: Allowed memory size of 12582912 bytes exhausted (tried to allocate 71 bytes) in - on line 340
So goto fork the file so that you can edit it and assign at the top. I was successful with
ini_set("memory_limit","128M");
This will increase the maximum amount of memory available to PHP to 128 MB for the running script. It is a temporary setting and will only affect the script it is in.

Categories