I'm having a mysterious problem at my web hosting provider, where maintenance/importImages.php is throwing an "out of memory" exception. Increasing PHP's memory limits doesn't seem to help. Has anyone experienced and solved this?
This hosting provider uses cpanel and jailshell. When I SSH into the system and, in jailshell, run the script, I get:
$ php importImages.php --overwrite ~ /upload Import Images Fatal error: Out of memory (allocated 7602176) (tried to allocate 7680 bytes) in /home/user/public_html/w/includes/filerepo/LocalFile.php on line 145
Now here's the strange part:
- Hand-editing importImages.php and adding ini_set( 'memory_limit', 'some huge amount' ) makes no difference at all. - Adding a php.ini files in the current directory makes no difference - Inside jailshell, on another server in the same farm, I can run the script without error. - root can run the script without error (not in jailshell) anytime
Any clues? DanB
MediaWiki also sets a php.ini memory limit. Check LocalSettings and elsewhere
On Wed, Apr 22, 2009 at 1:00 PM, Daniel Barrett danb@vistaprint.com wrote:
I'm having a mysterious problem at my web hosting provider, where maintenance/importImages.php is throwing an "out of memory" exception. Increasing PHP's memory limits doesn't seem to help. Has anyone experienced and solved this?
This hosting provider uses cpanel and jailshell. When I SSH into the system and, in jailshell, run the script, I get:
$ php importImages.php --overwrite ~ /upload Import Images Fatal error: Out of memory (allocated 7602176) (tried to allocate 7680 bytes) in /home/user/public_html/w/includes/filerepo/LocalFile.php on line 145
Now here's the strange part:
- Hand-editing importImages.php and adding ini_set( 'memory_limit', 'some
huge amount' ) makes no difference at all.
- Adding a php.ini files in the current directory makes no difference
- Inside jailshell, on another server in the same farm, I can run the
script without error.
- root can run the script without error (not in jailshell) anytime
Any clues? DanB
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
On Wed, Apr 22, 2009 at 4:05 PM, Brian Brian.Mingus@colorado.edu wrote:
MediaWiki also sets a php.ini memory limit. Check LocalSettings and elsewhere
LocalSettings.php comes with # ini_set( 'memory_limit', '20M' );, but that's too large to be causing this problem, and it's commented out by default anyway. maintenance/commandLine.inc comes with ini_set( 'memory_limit', -1 );, but clearly it's not being followed.
On Wed, Apr 22, 2009 at 1:00 PM, Daniel Barrett danb@vistaprint.com wrote:
I'm having a mysterious problem at my web hosting provider, where maintenance/importImages.php is throwing an "out of memory" exception. Increasing PHP's memory limits doesn't seem to help. Has anyone experienced and solved this?
This hosting provider uses cpanel and jailshell. When I SSH into the system and, in jailshell, run the script, I get:
$ php importImages.php --overwrite ~ /upload Import Images Fatal error: Out of memory (allocated 7602176) (tried to allocate 7680 bytes) in /home/user/public_html/w/includes/filerepo/LocalFile.php on
line
145
Now here's the strange part:
- Hand-editing importImages.php and adding ini_set( 'memory_limit', 'some
huge amount' ) makes no difference at all.
- Adding a php.ini files in the current directory makes no difference
- Inside jailshell, on another server in the same farm, I can run the
script without error.
- root can run the script without error (not in jailshell) anytime
Any clues? DanB
It's possible to have multiple PHP configuration files, one for Apache and one for the CLI; if you're adjusting a php.ini file, make sure you're adjusting the CLI one. Since you're running a jailed/crippled shell, ini_set() is probably disabled (you can check with phpinfo()--assuming it's not disabled too ;)), so unless you have access to the php.ini file that's actually used, you're going to have to complain to your host.
I threw an "echo phpinfo()" into the importImages.php script and got:
memory_limit => 64M => 32M
So I wonder if there's another memory limit imposed by jailshell along the lines of "ulimit"? ulimit -a says:
core file size (blocks, -c) 200000 data seg size (kbytes, -d) 200000 scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 73728 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) 200000 open files (-n) 100 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 20 virtual memory (kbytes, -v) 200000 file locks (-x) unlimited
DanB
Just for the record (for future people who search the mediawiki mailing list)... we were never able to solve this problem. PHP keeps throwing out of memory errors for various maintenance scripts in jailshell, no matter what kind of limits we set.
DanB
On Wed, Apr 22, 2009 at 8:18 PM, Daniel Barrett danb@vistaprint.com wrote:
I threw an "echo phpinfo()" into the importImages.php script and got:
memory_limit => 64M => 32M
So I wonder if there's another memory limit imposed by jailshell along the lines of "ulimit"? ulimit -a says:
core file size (blocks, -c) 200000 data seg size (kbytes, -d) 200000 scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 73728 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) 200000 open files (-n) 100 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 20 virtual memory (kbytes, -v) 200000 file locks (-x) unlimited
DanB
I should have caught this before, but at least on the platforms that I've used, PHP's out of memory errors are of the form "Allowed memory size of x bytes exhausted", not "Out of memory"; this probably indicates that you're not hitting PHP's memory limit, but actually are running out of memory (presumably because it's limited at a different level by jailshell). This is the sort of thing you really do have to go to your host to get fixed, since a jailshell is going to have limits that (if it's secure!) can't be circumvented from within the shell.
mediawiki-l@lists.wikimedia.org