PHP 5.5 OPcache / ARM / Unable to allocate shared memory - php

Since PHP 5.5 OPcache is built-in.
I need to cross compile PHP with OPcache for an ARM-System.
PHP is running as Apache Handler without any CGI/FastCGI.
The configure-Script needs to be changed, so that flock_type = linux is set.
After activating OPcache in php.ini by setting
opcache.enable=1
zend_extension=/usr/local/apache2/modules/opcache.so
opcache.memory_consumption=1
After starting Apache the following error appears:
Fatal Error Unable to allocate shared memory segment of 8388608 bytes:
unknown: Numerical result out of range (34)
Whats wrong?
Best regards, Velocity

Related

PHP7.1 - Fatal Error Unable to allocate shared memory segment

I cross-compiled PHP7.1 for ARMv7 and enabled OPCache extension.
In php.ini:
zend_extension=opcache.so
opcache.enable=0
opcache.memory_consumption=4
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=0
On target machine, whenever I try to run a PHP script I get:
Fatal Error Unable to allocate shared memory segment of 8388608 bytes
I made sure that system shared memory allocation is correctly configured:
ipcs -ml:
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 131072
max total shared memory (kbytes) = 131072
min seg size (bytes) = 1
Disabling the OPCache makes the PHP scripts run as it should.
Any idea please?

Symfony randomly crash - DebugClassLoader.php

I have site based on symfony framework but on develop enviroment i have random crashes with exception: (with bad characters)
Warning: class_implements(): Class
���� does not exist and could not be loaded
or
Warning: class_implements(): Class H�d
���� does not exist and could not be loaded
or
ContextErrorException in DebugClassLoader.php line 203: Warning: class_implements(): Class multipart/form-data does not exist and could not be loaded
(php is not using symfony forms and request is GET)
or
OutOfMemoryException in DebugClassLoader.php line 203: Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1141972672 bytes)
(Memory limit is set on 128MB but for request is needed approximately 6MB)
All this different exceptions was thrown on one url with same parameter (for the testing purpose) so they are throwing randomly through whole web.
This bugs aren't on production enviroment only develop.
Develop enviroment is on windows 7 machine with XAMPP/apache.
If i restrat apache and press F5 everything is ok and web working ok.
I was trying clear all caches but without success.
Any ideas?
EDIT:
After activate OPCache the problem persists...
My config from symfony debug bar:
If i run command php bin/symfony_requirements from CLI
> PHP is using the following php.ini file:
C:\xampp7.0.9\php\php.ini
> Checking Symfony requirements:
...........................WW.......
[OK]
Your system is ready to run Symfony projects
Optional recommendations to improve your setup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* intl extension should be available
> Install and enable the intl extension (used for validators).
* a PHP accelerator should be installed
> Install and/or enable a PHP accelerator (highly recommended).
Note The command console could use a different php.ini file
~~~~ than the one used with your web server. To be on the
safe side, please check the requirements from your web
server using the web/config.php script.
I had the same problem with "Warning: class_implements(): Class ���� does not exist and could not be loaded"
I increased realpath_cache_size in php.ini and now apache works, no errors.

Apache 2.4 - mod_fcgid: stderr: PHP Fatal error: Out of memory

Apache 2.4.17 32-bit on Windows 10 x64, FCGI/PHP 7.0.4 32-bit. I am fighting with the error:
mod_fcgid: stderr: PHP Fatal error: Out of memory (allocated 117440512) (tried to allocate 201326600 bytes) in ...
There is many advices but nothing works. Are there more parameters that can affect it? My settings are:
PHP.INI:
memory_limit = 1500M ; confirmed in phpinfo()
HTTPD.CONF:
RLimitMEM 1500000000 1500000000
(RLimitMEM max max # didnt work too)
My physical memory is 12GB and 5.5 GB is permanently free.
I think this error didn't appear in Apache 2.2. I always needed memory limit greather than 500MB. Only one customer needs export to big CSV. The error occurs by concatenating strings. But I am concatenating always only 1 row and immediately writing it using fputcsv() into tempfile. One row reaches maximum 1-2 KB. I don't know about any variable that can grow over many megabytes.
Maybe memory leak or bad garbage collector in PHP 7?

PHP Warning: PHP Startup: Unable to load dynamic library '...' failed to map segment from shared object: Cannot allocate memory in Unknown on line 0

Im getting the following on my developer machine.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/gd.so' - /usr/lib/php5/20100525/gd.so: failed to map segment from shared object: Cannot allocate memory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/mcrypt.so' - /usr/lib/php5/20100525/mcrypt.so: failed to map segment from shared object: Cannot allocate memory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/mysql.so' - /usr/lib/php5/20100525/mysql.so: failed to map segment from shared object: Cannot allocate memory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/mysqli.so' - /usr/lib/php5/20100525/mysqli.so: failed to map segment from shared object: Cannot allocate memory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/pdo_mysql.so' - /usr/lib/php5/20100525/pdo_mysql.so: failed to map segment from shared object: Cannot allocate memory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/imagick.so' - /usr/lib/php5/20100525/imagick.so: failed to map segment from shared object: Cannot allocate memory in Unknown on line 0
Any ideas on what is going on here? I'm running mediawiki and for each pageload these warnings appear.
The files referenced in the warning messages exists and i've tried raising the memory_limit directive in php.ini to no avail. Any suggestions on how i can proceed with this?
Regardless of these warnings, the web application seems to take no harm.
I believe you need to raise $wgMaxShellMemory in LocalSettings.php (eg. $wgMaxShellMemory = 512000;)
Please read:
$wgMaxShellMemory
Miscellaneous settings: $wgMaxShellMemory
Maximum amount of virtual memory available to shell processes under Linux, in KB.
Introduced in version: 1.7.0 (r14795)
Removed in version: still in use
Allowed values: (integer)
Default value: 102400
Update: This solved my issue.
Same issue here. This seems to be related to MediaWiki 1.21. I upgraded a Wiki from 1.20 to 1.21 without changing any installed packages, and get this error too.
Image thumbnails are not being generated neither with rsvg nor with ImageMagick anymore.
If I roll back to 1.20, things work again.
Update
So I have tried to fix the issue here, and the only thing which worked was to downgrade to MediaWiki 1.20.6, where conversions of images to other sizes or formats for SVG images works with all supported converters.
If you do not have a backup of your database before the upgrade, you can use Special:Export to dump all pages, and import that into an empty installation.
Hope this will solve your problem
look at php.ini
look for something like this
;extension=pdo_sqlite.so
;extension=sqlite.so
Just comment it out:
extension=pdo_sqlite.so
extension=sqlite.so

Problem in migrating to LAMP from XAMPP.. Memory limit error

I was using XAMPP for my local machine but as I wanted to run applications like mysql work bench and some test frameworks I decided to switch to LAMP self install. I'm using ubuntu and followed the instructions at: https://help.ubuntu.com/community/ApacheMySQLPHP
But the problem is LAMP is consuming too much of my memory (RAM) I've allocated 124 MB currently but still it gives me memory exhausted error when I run Drush (Drupal command line). When I do drush cc to clear cache it give me the following:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /var/www/----/sites/all/modules/ubercart/uc_order/uc_order.order_pane.inc on line 150
Call Stack:
0.0020 185624 1. {main}() /opt/drush/drush.php:0
0.0254 1303672 2. drush_main() /opt/drush/drush.php:37
0.2674 5107784 3. drush_bootstrap() /opt/drush/drush.php:71
0.2676 5109872 4. _drush_bootstrap_drupal_full() /opt/drush/includes/environment.inc:173
0.2676 5151032 5. drupal_bootstrap() /opt/drush/includes/environment.inc:655
0.3030 7739048 6. _drupal_bootstrap() /var/www/missmoti/includes/bootstrap.inc:989
0.3122 8855792 7. _drupal_bootstrap_full() /var/www/missmoti/includes/bootstrap.inc:1078
0.3445 12387320 8. module_load_all() /var/www/missmoti/includes/common.inc:2608
0.5194 32586544 9. drupal_load() /var/www/missmoti/includes/module.inc:14
0.5251 33361112 10. include_once('/var/www/missmoti/sites/all/modules/ubercart/uc_order/uc_order.module') /var/www/-----/includes/bootstrap.inc:617
Drush command could not be completed.
In each error it shows me a back trace and I guess this default debugger I'm not aware of in Apache or my PHP config it eating up the memory. If anyone can help I"d be glad.
Another error below:
Fatal error: Call to undefined function dsm() in /var/www/-----/sites/all/modules/custom/gtpath/gtpath.module on line 180
Call Stack
# Time Memory Function Location
1 0.0002 120144 {main}( ) ../index.php:0
2 1.7604 68224112 theme( ) ../index.php:36
3 2.0188 77346112 call_user_func_array ( ) ../theme.inc:658
4 2.0188 77347024 gtpath_preprocess_page( ) ../theme.inc:0
how do I deal with this default debugger? how do I turn it off??
Drush also might be running with php-cli. There is a different php.ini for it, you can find it in ubuntu in /etc/php5/cli. If you just up the ram usage there you should be fine.
The last error is because you use dms when the devel module is deactivated. Might be some debugging code you used in dev.

Categories