PHP Warning: date(): It is not safe to rely on the system’s timezone settings.

On Apache error.log

...PHP Warning:  date(): 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 methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\\port\\Apache24-2.4.9\\htdocs\\index.html on line 34

Use on of this :
1. Edit php.ini, then restart Apache

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Jakarta

2. If your php.ini cannot be edit, you can use this function at the beginning of code

date_default_timezone_set('Asia/Jakarta');//or change to whatever timezone you want

3. Edit index.php without edit php.ini

if( ! ini_get('date.timezone') )
{
    date_default_timezone_set('GMT');
}

4. If you can’t modify php.ini, and don’t want to add a date_default_timezone call, then use gmdate()

<? print(gmdate("Y")); ?>
Advertisements

PHP error – Unable to initialize module API=20060613 – 20090626

My PHP on Apache error.log show this message :

PHP Warning: PHP Startup: java: Unable to initialize module\nModule compiled with module API=20060613\nPHP compiled with module API=20090626\nThese options need to match\n in Unknown on line 0

The solution :

uncommented 2 lines in php.ini,
;extension=D:\oss\php-5.3.6\ext\php_java.dll
;extension=D:\oss\php-5.3.6\php5servlet.dll

then restart apache, and the message disappear ^_^

OCI.dll could not be loaded in PHP-Apache

I’ve installed XAMP 1.6.6a  and running of apache 2.2.8 and PHP 5.2.5 versions. I also install oracle instant client 10.2.0.1.0 so i want to connect to oracle via php using oci.  I got this message when i start apache

Apache.exe
This application has failed to start because oci.dll was not found. Re-installing the application may fix this problem.

I had try to set these variable

ORACLE_HOME, ORACLE_SID, NLS_LANG

and uncomment the following lines in php.ini file

;extension=php_oracle.dll
;extension=php_oci8.dll;
also
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll

but error message would not dissapear

Then I copy oci.dll to folder apache\bin and restart apache, it works fine now. But make sure your oci.dll from Oracle 10, older version will not work.

You can test it using php.exe -m, if you can’t find any error or warning and you see oci8 in list then congratulations!! you succeed to setup oracle extension.

If another error message, such as

The procedure entry point OCIStmtPrepare2 could not be located in the dynamic link library OCI.dll,

then copy oci.dll to php directory and restart apache and test again