• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

PHP cookie across domain and subdomain

P

PlymWS

Guest
Hi,

I have Plesk 9.3 on a new server. I have a domian (domin.com) setup and a subdomain (sub.domain.com) setup as another domain rather than as a subdomain of the original. This allows me to specify a separate IP address for the subdomain and use 2 SSL certificates, one for the domain, one for the sub domain.

I am unable to use the sub.domain.com sookie to verify a session from domain.com Both domains are hosted on the same server and write their files to the same place.

I have tried chmod 777 the session files because the domains are controlled by a different user due to Plesk restrictions but this doesn't help.

I have also tried setting the session domain in php.ini as .domain.com but this also doesn;t help.

Anything else I can try ?
 
The issue you describe is not specific to Plesk - cookies cannot be accessed across domains.

In PHP you should be able to set the cookie with the domain in the form of ".domain.com" and this will allow the main site, and subdomains to access the cookie.

There is a section on the PHP site relating to this, specifically a section relating to setting the domain:

http://php.net/manual/en/function.setcookie.php

Paul
 
i have a similar issue and i would say it is related to plesk,
This code

<?php
ini_set('session.cookie_domain', '.domain.com' );
$some_name = session_name("domain");
session_set_cookie_params(0, '/', '.domain.com');
session_start();

makes problems go away in servers with no plesk,
but problem remains in server with plesk

surprise!

so please what is wrong in plesk configuration to interfere with session communication between subdomain and domain?

thank you
 
Back
Top