- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在使用 MAMP,但我遇到了 session 问题。我的代码在 WAMP 上完美运行,但在 MAMP 上不起作用,我不知道为什么。我查看了 phpinfo,但对于 MAMP 和 WAMP 之间的 session ,它们是相同的。
PHP 日志文件: [01-May-2012 12:18:28] PHP Warning: session_start() [<a href='function.session- start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /Applications/MAMP/htdocs/Website/index.php:7) in /Applications/MAMP/htdocs/Website/header.php on line 2
[01-May-2012 12:18:28] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /Applications/MAMP/htdocs/Website/index.php:7) in /Applications/MAMP/htdocs/Website/header.php on line 2
Apache 日志文件: [Tue May 01 12:03:29 2012] [notice] Digest: generating secret for digest authentication ...
[Tue May 01 12:03:29 2012] [notice] Digest: done
[Tue May 01 12:03:29 2012] [notice] Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.6 configured -- resuming normal operations
[Tue May 01 12:04:11 2012] [notice] caught SIGTERM, shutting down
[Tue May 01 12:04:24 2012] [notice] Digest: generating secret for digest authentication ...
[Tue May 01 12:04:24 2012] [notice] Digest: done
[Tue May 01 12:04:24 2012] [notice] Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8r DAV/2 PHP/5.3.6 configured -- resuming normal operations
[Tue May 01 12:05:11 2012] [error] [client 127.0.0.1] client denied by server configuration: /Applications/MAMP/htdocs/.DS_Store
为什么它们不起作用?
谢谢。
最佳答案
看这里:
headers already sent by (output started at /Applications/MAMP/htdocs/Website/index.php:7)
在您调用 session_start()
之前,该行会生成一些输出。如果您生成任何输出(即使只是一个换行符或其他东西,空格,您命名它)一个 header 将被发送,您不能为 session_start()
发送另一个 header 。
我怀疑它与您的 *AMP 有什么特别的关系。
关于php - session 不适用于 MAMP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10396907/
我是一名优秀的程序员,十分优秀!