Sessions do not work on MAMP

I am using MAMP, but I have a session problem. My code works fine on WAMP, but not on MAMP, and I don't know why. I looked at phpinfo, but there is the same thing for the session between MAMP and WAMP.

PHP Log File: [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 Log File: [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

Why don't they work?

Thank.

+3
source share
2 answers

Look at here:

 headers already sent by (output started at /Applications/MAMP/htdocs/Website/index.php:7)

there is some output on this line generated before the call session_start(). If you generate ANY output (even just a new line or something like a space, you name it), the header gets send, and you cannot send another header for session_start().

I doubt that you have anything special in your * AMP.

+3
source

I also use MAMP for Mac.

.

:

, php . PHP (doctype)

, .

, , (php) . .

GL

0

All Articles