Search code examples
phpubuntularavel-4laravel-routingmemory-limit

PHP not recognizing memory_limit changes


I was hoping someone could help me out. I cannot get the memory_limit config setting to work on my PHP laravel install. Even something as simple as php artisan --help gives me a memory exhausted error.

I've tried modifying all my php.ini files, and specifying the config via the -d flag , but none of them seem to work. I feel like there's something else I'm missing?

Here's some shell output from my setup, please let me know if there's anything else you'd like to see.

vagrant@precise64:/vagrant/www$ uname -a
Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

vagrant@precise64:/vagrant/www$ php --version
PHP 5.4.33-2+deb.sury.org~precise+1 (cli) (built: Sep 25 2014 09:06:25) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

vagrant@precise64:/vagrant/www$ php -i | grep php.ini 
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini

vagrant@precise64:/vagrant/www$ php -i | grep memory_limit
memory_limit => -1 => -1

vagrant@precise64:/vagrant/www$ grep -r memory_limit /etc/php5/
/etc/php5/cli/php.ini:memory_limit = -1
/etc/php5/fpm/php.ini.ucf-dist:memory_limit = -1
/etc/php5/fpm/php.ini:memory_limit = -1
/etc/php5/fpm/pool.d/www.conf:php_admin_value[memory_limit] = -1

vagrant@precise64:/vagrant/www$ grep -r safe_mode /etc/php5/ | grep =   
/etc/php5/cli/php.ini:sql.safe_mode = Off
/etc/php5/fpm/php.ini.ucf-dist:sql.safe_mode = Off
/etc/php5/fpm/php.ini:safe_mode = Off
/etc/php5/fpm/php.ini:safe_mode_gid = Off
/etc/php5/fpm/php.ini:safe_mode_include_dir =
/etc/php5/fpm/php.ini:safe_mode_exec_dir =
/etc/php5/fpm/php.ini:safe_mode_allowed_env_vars = PHP_
/etc/php5/fpm/php.ini:safe_mode_protected_env_vars = LD_LIBRARY_PATH
/etc/php5/fpm/php.ini:sql.safe_mode = Off

vagrant@precise64:/vagrant/www$ php artisan --help
PHP Fatal error:  Allowed memory size of 262144 bytes exhausted (tried to allocate 3072 bytes) in /vagrant/www/app/controllers/TemplateController.php on line 44

Thanks so much in advance, I really have no idea what could be wrong.


Solution

  • This ended up being a weird problem with my routes.php from within Laravel. I had two controllers (WebhookController and TemplateController) specified as Route::controllers, and TemplateController again specified as a Route::resource.

    This ended up causing the memory exhaustion errors for reasons I still can't figure out, but that's beside the point.

    The fix was to manually specify the controller routes and not use Route::controller at all within my routes.php.