If calling logout.php when it containts the code below does not print test then there is something else wrong and it has nothing to do with the sessions.
You mention that it still shows the index.php, which makes me thing you have a rewrite rule in your .htaccess file which redirects the call from logout.php to the index. Check your htaccess file for any rules.
You can find information about htaccess on MAMP here
Thank you for your answer. Unfortunately, I couldnt fix it. I have only one .htcacces file, not in my site root folder: Options -Indexes I just tested the following: I changed the link in my menu to logout1.php and also made a logout1.php file; both logout.php and logout1.php are located in the site root folder. In logout1.php I made a simple echo statement: <?php echo 'test'; ?> Still this file isnt reached. All my other links in the menu work without any problem. Under XAMPP there was also no problem. Do you have a suggestion to fix this?
You say it isnt reached. What do you see? 404 not found error or another page?
For some reason the logout1.php is now simply displayed. So I see the 'test' is echoed. If you look at my comment above it that now two problems occur: 1. When I go to logout.php by clikcing on the link the session info file is not destroyed (I see that in finder). 2. If I go type in the address manually the session info file is deleted after some seconds. 3. If I go back to index.php it first seems as if I am logged in. Then I refresh, and index.php looked as if I am logged out. Do you know a solution? (Thank you for your help so far!)
Addition: when I alter the link path in my menu.php from logout1.php to logout.php it takes quit some seconds before this is updated on the actual page (I do refresh after I have saved the changes). Maybe this info helps you.
And another addition: it seems that I only get the index.php for logged out people after I click the refresh button, thus: 1. Clicking on the link to the logout.php doesnt delete the session file; going there manually does delete the session file. 2. Then going back to index.php and clicking on a link to index.php then it still shows as if I am logged in. If i click refresh this changes.