0

I'm creating a connection between an android mobile and a server. For this purpose I'm using XAMPP 1.8.0 with PHP: 5.4.4 on a Windows x64 7. Ten days ago, I was working with a code that worked 100%. Because of other work I couldn't work more with this project. Today I launched my app and surprise! There's a warning from function date and an error in the connection:

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:\SERVER\xampp\htdocs\creater.php on line 13
[{"errorInfo":null}]

WTF have happened? In this time I updated windows with some windows update fixes and my mobile was updated from android 4.0.2 to 4.1.2.

PD. Error info comes from:

try{
    $link = new PDO('mysql:unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock;host=localhost;dbname=mydb', 'root', '');
    $link->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
    $link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

} catch(Exception $e) { 
    echo json_encode(array($e));
    exit();
}
Learning from masters
  • 2,032
  • 3
  • 29
  • 42
  • Possible duplicate of http://stackoverflow.com/questions/5535514/how-to-fix-warning-from-date-in-php – aynber Jul 16 '13 at 17:47
  • That resolves the date problem but I still consider that this is very strange because ten days ago I didn't have any problems with this. Anyway, the main problem is not resolved. – Learning from masters Jul 16 '13 at 17:51
  • I'm not sure. That error comes from PHP itself, so I don't know why it would have changed. Try instead of catching Exception, try catching PDOException $e, and see if that gives you anything different. – aynber Jul 16 '13 at 17:54
  • the question is if your timezone was set 10 days ago or simply the error was not shown. However, you should definitly set the timezone. I personal prefere to use a linux vm on windows host instead of installing xampp. You dont have to deal with windows issues and it is easy to port the vm to another pc. – steven Jul 16 '13 at 18:00
  • If I use PDOException it still says "[{"errorInfo":null}]". My code is a little bit old and last days I uploaded to use it with multipartcontent but when I leave all was ok. It is very strange. – Learning from masters Jul 16 '13 at 18:02
  • from the docs: The MySQL Unix socket (shouldn't be used with host or port). http://php.net/manual/en/ref.pdo-mysql.connection.php – steven Jul 16 '13 at 18:06
  • I think I get the problem. I cannot access to phpMyAdmin. It says "Not find mysql extension. Check the PHP configuration" but extension=php_mysql.dll is enabled (and aslo pdo) – Learning from masters Jul 16 '13 at 18:09

1 Answers1

0

Finally, I resolve my problem. I think that the problem was with the socket that I don't know why, it was missing. Anyway, I thought that the fastest way to resolve it was reinstalling xampp and so I did. Just in case somebody does it, if you want to backup data, copy htpdoc folder and mysql/data. If your DDBB is InnoDB DO copy ib* files for restoring it. Without them you can't and you need to create from 0 your DDBB.

Learning from masters
  • 2,032
  • 3
  • 29
  • 42