Iam familiar with ROR development. But recently started working in php zend framework. Is their a way to see the development logs live in the terminal(in linux) same as ROR as.
RAILS_ENV=development
rails s
But In Zend the its terminal command
php -S 0.0.0.0:8080 public public/index
produce logs in production environment.How to get them development like to monitor the code more specifically.
In documentation it has it like:
if ($_SERVER['APPLICATION_ENV'] == 'development') { error_reporting(E_ALL); ini_set("display_errors", 1); }
But show error message in terminal as:
PHP Notice: Undefined index: APPLICATION_ENV in /var/www/html/skeleton/public/index.php on line 7
that's bit wearied please suggest a way out thanks.
The problem
The documentation assumes that you’re using Apache:
Source: the manual.
First solution: define
APPLICATION_ENVAs discussed in another question, you should be able to run your development server with defined
APPLICATION_ENVusing the following command:Second solution: use Apache
You may simply setup an Apache
VirtualHostas said in the manual. Put the following in yourVirtualHostconfig:And update your
hosts:Refer to the manual in case of problems.
Third solution: use
zf-development-modeI won’t guide you through installation of this package (here are some instructions), but I’ll present two solutions for checking (in your code) whether development mode is enabled.
First method: check if
config/development.config.phpexistsAfter enabling development mode, contents of
config/development.config.php.distshould be copied toconfig/development.config.php. In your code, use the following to check if you’re in development mode:Second method: inject application config
Let’s assume that you want to check if development mode is enabled in a controller/service or other thing that can be created by a factory implementing
zend-servicemanager’sFactoryInterface. Below I present example application config, factory and service:config/development.config.php.distApplication\Service\Factory\ExampleServiceFactoryApplication\Service\ExampleService