Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Errors when i run oil in command line - Answered
Brice
August 2018
Hi,
I have this errors when i run
"
php oil -v"
in command line :
PHP Fatal error: Maximum function nesting level of '256' reached, aborting! in /web/test.website.com/fuelphp/1.8/fuel/core/classes/view.php on line 331
PHP Stack trace:
PHP 1. {closure:/web/test.website.com/fuelphp/1.8/fuel/core/bootstrap.php:74-88}() /web/test.website.com/fuelphp/1.8/fuel/core/bootstrap.php:0
PHP 2. Fuel\Core\Errorhandler::exception_handler() /web/test.website.com/fuelphp/1.8/fuel/core/bootstrap.php:87
PHP 3. Fuel\Core\Errorhandler::show_php_error() /web/test.website.com/fuelphp/1.8/fuel/core/classes/errorhandler.php:130
PHP 4. Fuel\Core\View->__toString() /web/test.website.com/fuelphp/1.8/fuel/core/classes/errorhandler.php:252
PHP 5. Fuel\Core\Errorhandler::exception_handler() /web/test.website.com/fuelphp/1.8/fuel/core/classes/view.php:217
PHP 6. Fuel\Core\Errorhandler::show_php_error() /web/test.website.com/fuelphp/1.8/fuel/core/classes/errorhandler.php:130
PHP 7. Fuel\Core\View->__toString() /web/test.website.com/fuelphp/1.8/fuel/core/classes/errorhandler.php:252
PHP 8. Fuel\Core\View->render() /web/test.website.com/fuelphp/1.8/fuel/core/classes/view.php:213
PHP 9. Fuel\Core\View->process_file() /web/test.website.com/fuelphp/1.8/fuel/core/classes/view.php:665
PHP 10. Fuel\Core\View->unsanitize() /web/test.website.com/fuelphp/1.8/fuel/core/classes/view.php:263
I need help, please.
Brice
August 2018
Ok, i found the problem.
I check IP in app/bootstrap.php to switch environment :
$available_ips = array('xx.xx.xx.xx', 'yy.yy.yy.yy');
if(in_array($_SERVER['HTTP_X_REAL_IP'], $available_ips)):
Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::DEVELOPMENT);
else:
Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::PRODUCTION);
endif;
But PHP-CLI doesn't like
$_SERVER['HTTP_X_REAL_IP']
:)
Solution :
if(isset($_SERVER['HTTP_X_REAL_IP'])):
$available_ips = array('xx.xx.xx.xx', 'yy.yy.yy.yy');
if(in_array($_SERVER['HTTP_X_REAL_IP'], $available_ips)):
Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::DEVELOPMENT);
else:
Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::PRODUCTION);
endif;
//For PHP CLI
else:
Fuel::$env = (isset($_SERVER['FUEL_ENV']) ? $_SERVER['FUEL_ENV'] : Fuel::PRODUCTION);
endif;
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Brice
August 2018