Andrew Liu Andrew Liu - 5 months ago 17
SQL Question

PHP How to allow subdomain to check for registered account?

I made a website and a subdomain for it On the main domain, I have set up a user login system with a MySQL database. On the main domain, the php code can successfully check whether the user has logged in or not. However, since the registration/login page is inside the main domain directory, the webpages on the subdomain are unable to do the same. How do I make it so that both domains connect to the same database and check for the same account?


You can do this from 4 methods:

Place this in your php.ini:

session.cookie_domain = ""

Or in your .htaccess:

php_value session.cookie_domain

Or as the first thing in your script:

ini_set('session.cookie_domain', '' );

Or in your php-fpm pool configuration for your site:

php_value[session.cookie_domain] =

you can view here