我不知道 PHP 脚本。我是一名 iPhone 开发人员。我想为我的 iPhone 应用启用 Apple 推送通知。我正在关注教程http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2。从终端运行 push.php 文件时,我的 push_development.log 文件中出现以下错误,
终端命令:
unknownc42c032e8297:~ creagx$ cd /Users/creagx/Desktop/PushChatServer
unknownc42c032e8297:PushChatServer creagx$ php push/push.php development
push_development.log 文件中的错误消息:
2012-05-14T10:17:14+05:30 Push script started (development mode)
2012-05-14T10:17:14+05:30 Exiting with fatal error: exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such file or directory' in /Users/gopi/Desktop/PushChatServer/push/push.php:82
Stack trace:
#0 /Users/gopi/Desktop/PushChatServer/push/push.php(82): PDO->__construct('mysql:host=loca...', 'gopipush', 'uH4q9xQGNAuFW...', Array)
#1 /Users/gopi/Desktop/PushChatServer/push/push.php(36): APNS_Push->__construct(Array)
#2 {main}
我想知道通过这个命令传递的值是什么?
// Create a connection to the database.
$this->pdo = new PDO(
'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['dbname'],
$config['db']['username'],
$config['db']['password'],
array());
writeToLog('PDO Value: ' . $this->pdo);
我尝试使用 打印日志文件中的 PDO 值writeToLog('PDO Value: ' . $this->pdo);
。谁能告诉我如何知道 pdo 值?提前致谢。
编辑:
// Create a connection to the database.
$this->pdo = new PDO(
'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['dbname'],
$config['db']['username'],
$config['db']['password'],
array());
writeToLog('Host: ' . $config['db']['host']);
writeToLog('DataBase: ' . $config['db']['dbname']);
writeToLog('Username: ' . $config['db']['username']);
writeToLog('Password: ' . $config['db']['password']);
再次在日志文件中收到相同的错误消息。我认为writeToLog('Host: ' . $config['db']
['host']); 行将不会编译,直到行中的错误修复$this->pdo
。这是对的吗?请帮我。提前致谢。