Reputation: 1387
I installed MAMP for windows
I have this error since several hours...
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: date_default_timezone_get(): It is not safe to rely on the system'
s timezone settings. You are *required* to use the date.timezone setting or
the date_default_timezone_set() function. In case you used any of those me
thods and you are still getting this warning, you most likely misspelled th
e timezone identifier. We selected the timezone 'UTC' for now, but please s
et date.timezone to select your timezone.
In the php.ini
concerned (C:/MAMP/conf/php5.5.19/php.ini), I changed the line DATE like this:
[Date]
; Defines the default timezone used by the date functions
date.timezone = "Europe/Paris"
And in my phpinfo()
, the path loaded is :
Loaded Configuration File C:\MAMP\conf\php5.5.19\php.ini
When I do in the consol the command php --ini
I have this :
C:\Users\Thomas>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
Why Configuration File (php.ini) Path:
is "C:\Windows"
and not C:\MAMP\conf\php5.5.19\
. Can I change this Path ?
I don't know what to do now...
thanks !
Upvotes: 0
Views: 973
Reputation: 245
TL:DR - Make sure to edit both the ..\MAMPPRO\conf\php[version].ini
and the ..\MAMP\bin\php\php[version]\php.ini
with your correct/approved php timezone.
So while I was going through my setup, I had the same issue.
I was taking a look at my phpinfo() and it was giving me a path to my "Loaded Configuration File" that was located in my ..\MAMPPRO\conf\php[version].ini
so I was editing that file with approved timezone from http://php.net/manual/en/timezones.php making sure to avoid any from http://php.net/manual/en/timezones.others.php.
After a few restarts and no success I started to dig a little further into where MAMP Pro was pulling that ini.
I found the solution in ..\MAMP\bin\php\php[version]\php.ini
. If I edited this file IN ADDITION TO editing the MAMP Pro ini everything worked properly.
Hopefully this can help you out!
Upvotes: 0
Reputation: 608
When you set configuration in MAMP it only affects PHP which is loaded in Apache module handler mode (mapped as module inside Apache process). If you want to set PHP CLI you need to set this separately from web server configuration.
this command will list your current PATH variable with all paths. For example, something like this:
C:>echo %PATH%
C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\binaries\php\php_runningversion ;C:\ProgramData\Oracle\Java\javapath;C:\Perl\site\bin;C:\Perl\bin ...
now enter following command
SET PATH=%PATH%;c:\mamp\bin\php\php5.6.0\;
This will going to add path to php5.6.0 version from MAMP folder.
you can now test your PHP CLI by entering following command :
php -v
then try to initialize configuration from MAMP for version PHP5.6.0 file:
C:>php -c "c:\mamp\conf\php5.6.0\php.ini" --ini
Configuration File (php.ini) Path: C:\WINDOWS Loaded Configuration File: C:\MAMP\conf\php5.6.0\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none)
You can use command -c from PHP CLI to set path to configuration file; and "c:\mamp\conf\php5.6.0\php.ini" is path to PHP ini file for version 5.6.0.
If you do not want to always add path to configuration file with -c command, just copy php.ini file from C:\MAMP\conf\php5.6.0\ to C:\MAMP\bin\php\php5.6.0\
Off course, this will going to set PHP CLI only in currently opened command prompt. To add this path permanently, you need to modify System Environment variable, or to use MAMP PRO as it already have this feature on PHP options page.
Upvotes: 0
Reputation: 26
I had the same error. I had no clue where it was coming from, but with some trial and error I figured out it had something to do with the special character in my htdocs folder:
htdocs/Exámple
By changing that character to a normal character (thus changing to htdocs/Example), I no longer got the error and the site would load normally.
Upvotes: 1
Reputation: 1830
The problem is that your xAMP server and cli access uses different php configuration.
One is C:\Windows\php.ini for CLI Second is C:\MAMP\conf\php5.5.19\php.ini for web server
Make sure you have updated both files.
Secondly do not forget to restart xAMP server, as apache do not reload libapache2-mod-php5 configs automatically.
Upvotes: 1
Reputation: 1373
At the beggining of your web/app_dev.php and web/app.php you can add:
date_default_timezone_set('Europe/Paris');
Upvotes: -1