Same domain, different folder PHP session

Solution 1:

Set the path in the session cookie with session_set_cookie_params. Before session_start of course.

Solution 2:

If /app1 and /app2 contain completely unrelated applications, you could institute completely unrelated sessions on both by using PHP's session_name(), function. Generally, sessions work with a cookie called PHPSESSID. Instead, in /app1 you can run session_name('session_app_1') and in /app2 you can run session_name('session_app_2'). Now the sessions in the two applications will be completely unrelated.

Warning: PHP's documentation says that the session_name() function is expensive. Perhaps leave the session with the default name in the busier app, and rename it only in the quieter app.