Mysql with PHP on Sun Java System Web Server 7.0

testMysql The PHP Add-on 1.0 has Mysql support built into it. To test whether mysql works with Sun Java System Web Server or not, write the following simple script (in testMysql.php) and test it out. I have used 5.0.41 (The Web Server PHP Add-on works with all 5.x versions of mysql) version of mysql with user name as 'root', password as 'adminadmin', and database as 'rakesh'.

Note: please refer to my last post on setting up PHP with Sun Java System Web Server. I assume that you have already created a fastcgi handler with URI  pattern as '/php/\*' and role as 'responder'.

<?php
    $username = root;
    $password = adminadmin;
    $database = rakesh;

    mysql_connect(localhost, $username, $password) or die ("Error connecting to mysql");
    print "Connected Successfully!! <BR>";

    mysql_close();
?>

If there was no error in the connection to the database, you should observe just the following, when your request to the web server is something like this: http://localhost:1894/php/testMysql.php.
  • Connected Successfully!!

Lets deliberately introduce some error into the script by providing a wrong password ($password = wrongpassword) in the script. Again send a request to the web server as http://localhost:1894/php/testMysql.php. You should get the following error messages.

  • Warning: mysql_connect() [function.mysql-connect]: Access denied for user
    'root'@'localhost' (using password: YES) in C:\\rak\\ws71\\iplanet\\ias\\server\\work\\B1\\WINNT4.0_DBG.OBJ\\https-test\\
    docs\\php\\testMysql.php
    on line 6
    Error connecting to mysql

Comments:

Download Opensource CMS Freely

http://phpfunda.blogspot.com/

Project management System in PHP - MySQL - http://phpfunda.blogspot.com/2007/09/project-management-system-in-php-mysql.html

content management systems - http://phpfunda.blogspot.com/2007/08/content-management-systems.html

Posted by smartcoder on February 01, 2008 at 07:11 AM IST #

Download Project Management System developed in PHP,MySQL from http://phpfunda.blogspot.com/2007/09/project-management-system-in-php-mysql.html

Posted by smartcoder on February 01, 2008 at 07:13 AM IST #

Nice blog.

Sun Web Server and MySQL database server works great, performs well. There are several sites like this blogs.sun.com run this combination supporting tens of thousands of users on a relatively modest hardware. See also, Benchmark UltraSPARC T2 beats Xeon on Consolidation of OLTP & Web
http://blogs.sun.com/ritu/entry/mysql_benchmark_us_t2_beats.

Cheers.

Posted by cvr on July 10, 2008 at 09:00 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

rakeshkumarp

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today