It seems that my browser didn't set cookies even the reponse header has Set Cookie value. I tried to use setcookie() to set the value manually and it logs me in. So the session is created successfully on the server. It's the problem on my side, but not that my browser cannot create cookie. But something prevented the creation during the log in process of drupal 7.
Here is the header from Drupal 7
Set-Cookie SESS26bc541d314e909277ae077251e81e7a=Ls1YzDrjBy-KLbYT_b9VfpcVrRRyjKnS_5J6MPgkjjU; expires=Sat, 30-Mar-2013 20:59:08 GMT; path=/tmp; domain=.testd720.com; httponly
The URL is clean. I can enter "/user", "user/register", "user/password" without problem.
Here are my nginx settings and drush commands that I used
Nginx setting
server
{
listen 80;
server_name www.testd720.com;
index index.php index.html index.htm;
root /opt/www/drushtest/web1;
error_page 404 = @drupal;
location @drupal {
rewrite ^(.*)$ /index.php?q=$1 last;
}
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
access_log logs/testd720.log main;
}
drush command to install drupal and change password
>drush dl drupal –drupal-project-rename=web1 -y
>drush site-install –db-url=mysql://testd720:123123123@localhost/testd720 –account-name=admin –account-pass=123123123 -y
>drush upwd admin –password=”111111111″ –debugI can register a new user from browser and I can see that new user created in users table. I can also change admin's password as I see the encrypted password changed in users table.
The same server is running other websites with session and cookie non-drupal applications like wordpress so I am out of means.
Why?
Comments
Makes no sense if you are not
Makes no sense if you are not using caching. If you do use caching with nginx (which I am not familiar with, but the principal is the same with Varnish) you should disable caching for logged in users - googling brings up some suggestions how to configure this http://jeradbitner.com/blog/2012/02/09/nginx-do-not-cache-logged-in-drup... http://forum.nginx.org/read.php?2,220510,220512#msg-220512 etc.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
Read you links
Thanks for the input. Reading your links.
My nginx conf is below.
I didn't deal with cookies for Drupal site in my nginx conf . Maybe I should. Keep reading your links.
The problem site vhost is below.
I didn't use caching
I don't think I used caching.
Would it be related to permissions? I installed Drupal by root user. Nginx and php-fpm is started by root user as well.
I cannot see how permissions
I cannot see how permissions could affect it (though running the server as root sounds like a security risk). If there is no caching other than Drupal inbuilt caching, the site should be able to write sessions cookies to the database and read them just as it runs all the other code.
Beyond that, I cannot advise as I have no nginx skills. I did respond on the caching issue because I have seen this happen on Varnish, which I do use. But having looked into the matter I decided that since nginx brings little speed benefit on low-traffic sites, nginx was not worth the hassle. I just use Apache.
Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors
problem solved.
Problem solved. I got help from http://stackoverflow.com
It turned out that I had a wrong cookie path setting in php.ini. It should be "/". I somehow changed it to "/tmp". Strangely, this is OK with Wordpress and Cakephp website...Now I am just glad that Drupal works.
This caused me almost 2 days. I am almost about to re-install PHP or upgrade it.
I guess that this is also why I met the notorious bug "31 tables" that I cannot intall drupal from browser but only through drush. It stopped in the middle with only 31 tables created. I just tested, it works now.