When I give the command: echo ini.get('date.timezone') . "<br>";
nothing appears, I already configured it in php.ini and nothing, I also already put the default in the code and nothing too. Can anyone help me?
When I give the command: echo ini.get('date.timezone') . "<br>";
nothing appears, I already configured it in php.ini and nothing, I also already put the default in the code and nothing too. Can anyone help me?
In my opinion, it is a syntax error:
Replace ini.get('date.timezone')
with ini_get('date.timezone');
Example:
<?php
echo 'date.timezone: ' . ini_get('date.timezone');
?>
When syntax errors happen they are reported on screen, if they do not appear on the screen they are stored in logs, this data is very useful for solving problems or for questioning to third parties who do not have access to the project.
In which environment are you developing the system? As apparently the syntax error was not reported on screen probably PHP is configured not to display, if this is in the production environment is correct, but if it is in development or testing environment is "wrong", since it is good that the developer to become aware of the problems in the application.
Open the terminal and the command tail -f /var/log/apache2/error.log
this command will be monitoring the Apache error file so each test will appear the new information inserted in the log, to clarify things with each test you can press the Enter
to open a space between the last error and the next one for visualization to be simpler. These spaces (Enters) will not be saved in the Log. To exit, you only need to Ctrl + c
;
WAMP : Follow the steps:
1 - Right click on the wamp icon near the clock
2 - Access the PHP submenu
3 - And click on PHP Error Log
In this way you will have to reload the file every time you do a new test, using Sublime Text 3 to open this log it will identify a change in the contents of the file and ask if you want to reload it by clicking% it will update for you.
XAMP : same as in WAMP
Note: If you have installed Apache and PHP direct, just give a quick search on the net that you find easy. But I've never seen anyone direct.
Open the file sim
here located at php.ini
find the following lines or add at the end of the file
error_reporting = E_ALL
display_errors = On
log_errors = On
The /etc/php/5.5/apache2/php.ini
option sets the type of error level that will be reported, error_reporting
will report all. It is not legal to report bugs in the production environment as malicious users can and will use this information to hack into your system. In development and testing environment it is strongly recommended E_ALL
to let no error go into the production environment.
The E_ALL
option sets whether errors will be reported on the screen, if you wanted to set display_errors
after the equal sign if you do not want to on
The off
option defines whether errors will be reported in the log, if you wanted to put log_errors
after the equal sign if you do not want to put on
This form of configuration also applies to the Windows environment since it is a peculiarity of PHP, what changes is just the path of the file , this in supposition since I do not work developing in Windows, but in the Linux, since my systems are hosted on Linux.