okay i might just be overlooking something,
i added a simple hello world .php file to my public_html
installed fcgid on all my server which were not installed via the install.sh
and everything is working great. phpmyadmin works file on all servers under fgid.
i also checked the hello world .php on CGI WRAPPER mode, so i THOUGHT it was working,
at the last minute i have setup a new site, and all Sub Servers have been set to use CGI Wrapper instead of cgi. however, i have noticed that while the very basic hello world script runs just fine, any application actually ends up failing with a segfault, and php is not allowed to allocated any memory.
i double checked php.ini files, default php.ini files, apache limits, cgi execution time, and even limits.conf (but nothing worked)
however, if i switch to fastcgid everything works fine.
i need cgi wrapper for my sub servers. any ideas?
here is the error i receive when trying to load the squirrel mail script: PHP Fatal error: Out of memory (allocated 524288) (tried to allocate 19456 bytes) in /home/appsrv/public_html/squirrelmail/functions/strings.php on line 373
also, what is bizzare, is that other servers are doing the same thing on my network (with virtualmin installed)
yeah i decided to go to my public/live server and setup a new domain using cgi wrapper. same thing.
all servers are running Ubuntu 12.04 lts (supported) and this one WAS installed with install.sh
at first i thought it was APC (it was complaining about not being able to allocate memory..), so i Purged php-apc, rebooted, deleted the virtual server and tried again. however, now php-cgi is complaining about not being able to allocate memory.
as i said, i double checked limits.conf. i dont think there is any issues with there. there are processes running with up to 10-15 children, and the only memory cap is at 512 MB per user, and 64MB per process as defined in php.ini
any ideas?
Howdy,
Hmm, it looks like you may be hitting that 512MB cap you mentioned... where is that set, is that part of the limits.conf?
Also, are you using a VPS? If so, what kind of VPS is it, are you by chance using OpenVZ?
And lastly, what output do you receive if you run "free -m"?
-Eric
this is happening on all my servers. one is a VPS with openVZ, however, the other two are dedicated ubuntu 12.04 lts servers.
the cap is set in limits.conf, but as i said, i have tried removing all entries from the file by copying it to another file and wiping it clean, restarting the server, and trying an entirely new virtual host
free -m reports as such:
Mem: 1002 756 246 0 155 418
-/+ buffers/cache: 181 821
Swap: 2106 0 2106
edit: i guess i should mention that all server report that there is on average about 3/4 free memory available, rarely dipping below half free. so this shouldent be a memory issue.
also, this is happening for any script which is run in CGI Wrapper mode, on any of my servers. but if i try a simple hello world, for example, just a PHP Print statement, or a phpinfo(); it Does work.
if i try any applications however (phpmyadmin, squirrel mail, etc), they all exit with the memory allocation error
and than if i use FCGId, all the problems go away
but i need cgi wrapper for my sub server / reseller accounts
Oh I see, so the 512MB is set in your php.ini file.
That seems to be the limit the script is hitting.
I can't explain why that limit is getting hit in one mode but not another -- that may just be the way the PHP scripts work.
However, to resolve the problem you're seeing, you'll likely need to increase the amount of memory allowed in the php.ini file.
You could always try disabling some PHP modules just to see if that helps... I'm not sure if it will or not, but if you're reluctant to increase the memory in the php.ini file, you could certainly try disabling some modules first to see if it makes a difference.
-Eric
sorry, must have gotten confused somewhere.
there should be no problems with limits. the only limit set is in limits.conf (512 mb),
php.ini does have a 64 mb limit (per process) however, i have also tested with both these OFF
everything works under fcgid, therefore, php is having no problems allocating memory, only when using CGI Wrapper
i infact seen one error where it could not allocate 16 bytes
Howdy,
Yeah, this error here:
Out of memory (allocated 524288) (tried to allocate 19456 bytes)
Means that there is a ~512MB limit being set somewhere -- and that PHP tried to allocate 19456 more bytes, but isn't allowed to due to the above limit. You'd get a similar message if PHP was attempting to allocate 16 bytes -- the problem is just that there's a limit that's been exceeded.
I can't explain why you're seeing different behavior in FCGI vs CGI modes, but it's likely somehow relating to how the scripts function.
The key is in finding where that limit is being set.
Rather than disabling the limits in the php.ini and limits.conf files though (which doesn't always work as expected), you may instead want to increase them.
When editing the php.ini file, you'd want to make sure you're editing the file in $HOME/etc/php.ini.
Also, you could try executing php's phpinfo(), in order to determine what php.ini files it's reading, just to make sure it's using the correct config file.
-Eric
whats making me think this has nothing to do with a limit is because i removed all apparent limits (also tried upping them) and did so after reboots to ensure configuration was always applied
it also works just fine for fcgid and mod_php, but just not regular cgi wrapper
the hello world i am using is actually a phpinfo() and is what i was using for testing while debugging this issue; it shows that it is loading the default php.ini copied to said users home directory (~/etc/...) as it is supposed to. it also shows all memory limits (when they WERE set) to what they are supposed to be set too
another thing to note is that nothing is above 512 mb. nor is the system even using more than 512 mb of memory. it usually sits around 150mb - 250 mb.
as you said i seems there is a 512 mb memory limit being set somewhere, but are we sure about this? (as said, the only limit set to 512 is in limits.conf and its clearly not causing any problems with anything else on the system, as mod_php and fcgid work flawlessly)
however, i will do back over your posts and double check what you have been saying and try to apply your advice. when i try these things i will post back with any success.
just noticed the primary node is giving a different error, and (out of all three) is the only one Not even running a PHPINFO:
/usr/bin/php5-cgi: error while loading shared libraries: libcrypto.so.1.0.0: failed to map segment from shared object: Cannot allocate memory
oh my lord, thank you, thank you, thank you-
it appears that there were some legacy specifics enabled for before we were offering shared hosting
under the Apache global configuration for the default virtual server, its sub processes were enforcing limits: and this is where the problem was
thank you again!
all i had to do to resolve the issue was remove the hard limit from the upper memory limit value in the apache Default virtual server configuration.
however, care to explain just why this is? it WAS set to 32 soft / 64 hard, but neither process should have been this high to begin with (anything was crashing it out)