php - Cookies don't work, apache to nginx -
i have moved website apache nginx, have problem website doesn't want send cookies (or start session) users when try log in on website.
this log in script:
<?php session_start(); include("includes/config.php"); $naam = mysql_real_escape_string($_post["naam"]); $wachtwoord = md5(mysql_real_escape_string($_post["wachtwoord"])); if (strlen($naam) > 0) { if (strlen($wachtwoord) > 0) { $uquery = mysql_query("select * users username = '".$naam."' , password = '".$wachtwoord."' limit 1"); if (mysql_num_rows($uquery)) { while($lid = mysql_fetch_array($uquery)) { $id = $lid["id"]; } $_session["lid"] = $id; header("location: me.php"); } else { header("location: index.php?error=1"); } } } ?>
this i'm using connecting mysql (my config file):
<?php $host = "ip address"; $username = "root"; $password = "password"; $db = "test"; $con = mysql_connect($host, $username, $password); if (!$con){ die('verbinding mislukt: ' . mysql_error()); } $db = mysql_select_db($db, $con); if (!$db){ die ('kan database niet vinden: ' . mysql_error()); } ?>
does know how fix it?
here's nginx config:
# # default server # server { listen 80 default_server; server_name ; #charset koi8-r; #access_log logs/host.access.log main; # load configuration files default server block. include /etc/nginx/default.d/*.conf; location / { root /usr/share/nginx/html/shine; index index.php index.html index.htm; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; } # redirect server error pages static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy php scripts apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass php scripts fastcgi server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/share/nginx/html/shine; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; include fastcgi_params; } # deny access .htaccess files, if apache's document root # concurs nginx's 1 # #location ~ /\.ht { # deny all; #} }
thanks!
thanks help. have found fix this. cookie save folder wasn't there , didn't had right cmod..
this command solved it:
mkdir /var/lib/php/session chmod -r 777 /var/lib/php/session
Comments
Post a Comment