redarrow Posted September 27, 2007 Share Posted September 27, 2007 advance thank you i am currently changing my services with new servers, i need to no is my setup correct for the my sql server to work with php thank you. router ip 192.192.0.1 port 3307 sever ip 192.192.0.1 now to connect to that mysql server am i right to do this in php. <?php $db=mysql_connect("192.192.0.1:3307","username","password",); mysql_select_db("what_ever",$db); ?> let say username and password are set as username and password and the ip is 192.192.0.1 will this enable me to use the extenal mysql server cheers. I think afther password is the port of the mysql connection not sure theo Quote Link to comment https://forums.phpfreaks.com/topic/70853-helpadding-a-mysql-server/ Share on other sites More sharing options...
redarrow Posted September 27, 2007 Author Share Posted September 27, 2007 according to the .net i got it correct for mysql and php to talk to each other on sep servers. if you see any problams tell me please cheers. standard port for mysql is :3306 <?php $db=mysql_connect("192.192.0.1:3306","username","password",); mysql_select_db("what_ever",$db); ?> router ip 192.192.0.1 port 3306 sever ip nic card 192.192.0.1 is that correct for a internal setup to speek to php server and the mysql server Quote Link to comment https://forums.phpfreaks.com/topic/70853-helpadding-a-mysql-server/#findComment-356197 Share on other sites More sharing options...
rarebit Posted September 27, 2007 Share Posted September 27, 2007 1. Is all this on an internal network? 2. Is it still not working? If so what error are you getting? Quote Link to comment https://forums.phpfreaks.com/topic/70853-helpadding-a-mysql-server/#findComment-356226 Share on other sites More sharing options...
redarrow Posted September 27, 2007 Author Share Posted September 27, 2007 This is on a internal network. what errors? none yet waiting for server delevery sorry here by 1pm. learning the process to setup a mysql server on a internal network, so php web server speaks to the mysql server. i have setup the new web server to the new apache and php versions correctly they work fine. now i need to no what the process to setup a internal mysql server. example php5.ini mysql settings get the ip of the new mysql server correct? Quote Link to comment https://forums.phpfreaks.com/topic/70853-helpadding-a-mysql-server/#findComment-356272 Share on other sites More sharing options...
rarebit Posted September 27, 2007 Share Posted September 27, 2007 So you don't know if it's not working, cos its not up yet! The php.ini file is irrelevant (maybe there is a way, I don't use it) Try dropping the two firewalls (since its internal), if it works you'll have to set your iptables. Otherwise your syntax looks correct and your port is correct. p.s. generally I install mysql first, also I presume you've followed the right install routes for building with mysql support. Nowadays I just use YUM to do the lot cos it updates so easily... Here's some code from how I connect: function db_test_mysql($db_host, $db_uname, $db_pass, $db_dbname) { // CHECK CONNECTION try { if ( !@ ( $conn = mysql_connect($db_host, $db_uname, $db_pass) ) ) throw new Exception (mysql_error()); } catch (Exception $e) { echo 'ERROR (MYSQL): ' . $e->getMessage(); return array(-1, $conn, "?"); } // CHECK DATABASE try { if ( !@ ( $res = mysql_select_db($db_dbname, $conn) ) ) throw new Exception (mysql_error()); } catch (Exception $e) { echo 'ERROR (DB): ' . $e->getMessage(); return array(-2, $conn, -2); } return array(0, $conn, $res); } I generally don't let it echo anything but for this... Quote Link to comment https://forums.phpfreaks.com/topic/70853-helpadding-a-mysql-server/#findComment-356319 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.