473,396 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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. ?>
  20.  
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
  3.  
  4. ; Maximum number of persistent links.  -1 means no limit.
  5. mysql.max_persistent = -1
  6.  
  7. ; Maximum number of links (persistent + non-persistent).  -1 means no limit.
  8. mysql.max_links = -1
  9.  
  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
  15.  
  16. ; Default socket name for local MySQL connects.  If empty, uses the built-in
  17. ; MySQL defaults.
  18. mysql.default_socket = 
  19.  
  20. ; Default host for mysql_connect() (doesn't apply in safe mode).
  21. mysql.default_host =
  22.  
  23. ; Default user for mysql_connect() (doesn't apply in safe mode).
  24. mysql.default_user = 
  25.  
  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 =
  32.  
  33. ; Maximum time (in seconds) for connect timeout. -1 means no limit
  34. mysql.connect_timeout = 60
  35.  
  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
  39.  
  40. [MySQLi]
  41.  
  42. ; Maximum number of links.  -1 means no limit.
  43. mysqli.max_links = -1
  44.  
  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
  50.  
  51. ; Default socket name for local MySQL connects.  If empty, uses the built-in
  52. ; MySQL defaults.
  53. mysqli.default_socket =
  54.  
  55. ; Default host for mysql_connect() (doesn't apply in safe mode).
  56. mysqli.default_host =
  57.  
  58. ; Default user for mysql_connect() (doesn't apply in safe mode).
  59. mysqli.default_user =
  60.  
  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 =
  67.  
  68. ; Allow or prevent reconnect
  69. mysqli.reconnect = Off
  70.  
  71. [mSQL]
  72. ; Allow or prevent persistent links.
  73. msql.allow_persistent = On
  74.  
  75. ; Maximum number of persistent links.  -1 means no limit.
  76. msql.max_persistent = -1
  77.  
  78. ; Maximum number of links (persistent+non persistent).  -1 means no limit.
  79. msql.max_links = -1
  80.  
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 2382
Dormilich
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

0
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 production version of mysql and the default packages...
6
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 has frozen up during the final step (MySQL Server...
8
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 doesn't works with MYSQL. And CGI doesn't show...
0
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 wwwroot and in my browser type in...
11
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 the line extension=php_mysql.dll I have...
0
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. Error Code=0 SQL State=null Cannot load JDBC...
1
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 "machine" using the "loopback" IP addr (127.0.0.1) to...
2
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 other php pages, i received an error, Fatal error:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.