472,348 Members | 1,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,348 software developers and data experts.

Configuring PHP to be able to use mysql in Vista.

Alright so I got php running and installed i have mysql running and installed the thing im having a hard time with is having the php to call information from the mysql database. Im on Windows Vista Ultimate, I'm using iis7 here is the code of the php.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.     $Username = "Webuser";
  3.     $Password = "password";
  4.     $Database = "sample";
  5.     $Hostname = "localhost";
  6.     $MySQLConnection = mysql_connect($Hostname, $Username, $Password) 
  7.         or die("Unable to connect to MySQL Database!!");
  8.     $MySQLSelectedDB = mysql_select_db($Database, $MySQLConnection) 
  9.         or die("Could not Set the Database!!");
  10.     $MySQLRecordSet = mysql_query("SELECT * FROM sample_table");
  11.     print "First Name  -  " . "Middle Name  -  " . 
  12.         "Last Name<br>";
  13.     while ($MyRow = mysql_fetch_array($MySQLRecordSet, MYSQL_ASSOC)) 
  14.     {
  15.         print $MyRow['FirstName'] . "  -  " . $MyRow['MiddleName'] . 
  16.             "  -  " . $MyRow['LastName'] . "<br>";
  17.     }
  18.     mysql_close($MySQLConnection);
  19. ?>
The database is already created I believe the problem perhaps is in the php.ini, here's what it looks like. My php folder is C:\PHP and mysql is C:\MySQL mysql is running on port 26. Here is the php.ini for the mysql settings

Expand|Select|Wrap|Line Numbers
  1. ; Allow or prevent persistent links.
  2. mysql.allow_persistent = On
  4. ; Maximum number of persistent links.  -1 means no limit.
  5. mysql.max_persistent = -1
  7. ; Maximum number of links (persistent + non-persistent).  -1 means no limit.
  8. mysql.max_links = -1
  10. ; Default port number for mysql_connect().  If unset, mysql_connect() will use
  11. ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
  12. ; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
  13. ; at MYSQL_PORT.
  14. mysql.default_port = 26
  16. ; Default socket name for local MySQL connects.  If empty, uses the built-in
  17. ; MySQL defaults.
  18. mysql.default_socket = 
  20. ; Default host for mysql_connect() (doesn't apply in safe mode).
  21. mysql.default_host =
  23. ; Default user for mysql_connect() (doesn't apply in safe mode).
  24. mysql.default_user = 
  26. ; Default password for mysql_connect() (doesn't apply in safe mode).
  27. ; Note that this is generally a *bad* idea to store passwords in this file.
  28. ; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
  29. ; and reveal this password!  And of course, any users with read access to this
  30. ; file will be able to reveal the password as well.
  31. mysql.default_password =
  33. ; Maximum time (in seconds) for connect timeout. -1 means no limit
  34. mysql.connect_timeout = 60
  36. ; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
  37. ; SQL-Errors will be displayed.
  38. mysql.trace_mode = Off
  40. [MySQLi]
  42. ; Maximum number of links.  -1 means no limit.
  43. mysqli.max_links = -1
  45. ; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
  46. ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
  47. ; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
  48. ; at MYSQL_PORT.
  49. mysqli.default_port = 26
  51. ; Default socket name for local MySQL connects.  If empty, uses the built-in
  52. ; MySQL defaults.
  53. mysqli.default_socket =
  55. ; Default host for mysql_connect() (doesn't apply in safe mode).
  56. mysqli.default_host =
  58. ; Default user for mysql_connect() (doesn't apply in safe mode).
  59. mysqli.default_user =
  61. ; Default password for mysqli_connect() (doesn't apply in safe mode).
  62. ; Note that this is generally a *bad* idea to store passwords in this file.
  63. ; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
  64. ; and reveal this password!  And of course, any users with read access to this
  65. ; file will be able to reveal the password as well.
  66. mysqli.default_pw =
  68. ; Allow or prevent reconnect
  69. mysqli.reconnect = Off
  71. [mSQL]
  72. ; Allow or prevent persistent links.
  73. msql.allow_persistent = On
  75. ; Maximum number of persistent links.  -1 means no limit.
  76. msql.max_persistent = -1
  78. ; Maximum number of links (persistent+non persistent).  -1 means no limit.
  79. msql.max_links = -1
If you could help it would be apprecieated, if you need more info let me know. This is just for my localhost to practice runs on iis7
Feb 27 '09 #1
1 2295
8,658 Expert Mod 8TB
do you get any error messages? if not try something like that, this should give you any SQL error messages.
Expand|Select|Wrap|Line Numbers
  1. $MySQLConnection = mysql_connect($Hostname, $Username, $Password) 
  2.         or die("Unable to connect to MySQL Database: " . mysql_error());
Feb 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Grant Cooper | last post by:
I was hoping someone could tell me a way to increase the productivity of a database server. It has nothing else installed other than the newest...
by: John Salerno | last post by:
Hi everyone. I hope someone can help me with this problem. I have installed MySQL CE 5.0, but during the configuration wizard I get an error. It...
by: Darwiniv | last post by:
1. Does anyone run ASAPI and mysql succesfully on Vista /IIS7? 2. Does anyone run CGI and display all SESSION errors on Vista /IIS7? php ASAPI...
by: hugoboss | last post by:
Hi folks, Well i've got php v5.2.1 installed, also MySQL v5.0.37 running perfectly on Vista using IIS 7, however when i unzip phpmyadmin to...
by: r035198x | last post by:
I have configured my PHP (5) to work on vista business fine. I've also successfully installed MySQL server 5.0 fine. In my php.ini I have enabled...
by: hInCh | last post by:
hi, i am having problem,configuring netbeans (tomcat 5.5) with mysql j/connector. i ve used datasources,and getting the error message like. ...
by: Vasya | last post by:
Hello, My goal is to setup and configure the "Community MySQL server" on my "Vista" laptop. I want to run the server and clients on the same...
by: lawrencesiow | last post by:
hi all, i got some problems with mysql when i test my phpinfo page i didn't see any mysql information at there and also when i try to test my...
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.