Reputation: 852
My "mysql_pconnect() / connect()
"` function doesn't work on a server over a VPN.
I used the VPN to access the server where in there I created a PHP website. When I run my website it's a blank page. I was wondering why it is a blank page, so I find the error, now the error is the database connection. but it's just the same with my localhost, and the website on my localhost is working. but when I transfer my website to the server it's not working. is there something to do with the VPN? My user and pass to connect to the mysql is correct.
main.php
error_reporting(E_ALL);
$settings_dir = "./settings";
require_once("$settings_dir/database2.php");
//etc etc codes..
database2.php
$conn=mysql_connect("localhost","root","passw0rd");
Upvotes: 0
Views: 1441
Reputation: 2956
thats because you cant give the same arguments to mysql_pconnect()
which you gave in case of your localhost.because where you hosted your website,there u will have diffrent server name ,DBname and DB password.
mysqli_connect(server,user,pwd,newlink,clientflag)
here the first argument is server which is the hostname,in case of local server its localhost but when you are using any remote server than u need to specify that server name.similarly username
and password
will be different for that server.
read here
http://www.w3schools.com/php/func_mysql_connect.asp
Upvotes: 1