lewmur Posted May 15, 2005 Share Posted May 15, 2005 This is my first attempt at using Apache, PHP and MySQL to create a Web page to access a database. I've installed MySQL and successfully used Navicat to import my database. I install Apache2 for Windows and can use my browser to access the index.html @ http://localhost. I d/l PHP ver 4.3 and followed the instructions to install it as an Apache2 module. It finds the php_apache2.dll and doesn't show any errors when starting Apache. So far everything looks OK.However, when I try to use Dreamweaver to create a PHP file to connect to the Database, I get an error saying there is no Testing Server running. How can I create a test html to check if PHP is connecting to MySQL? I know I can create an file and name it index.html and put it in the Apache directory, but what commands to I use in the file to test the connection? Quote Link to comment Share on other sites More sharing options...
epp_b Posted May 15, 2005 Share Posted May 15, 2005 (edited) Dreamweaver will have to be configured. Somewhere in the settings, you should have options to configure the locations and paths for the PHP server files.Also, you'll need to save your files that you want to run as PHP in the web root directory configured in Apache.I'd suggest using plain code to figure out whether PHP and/or MySQL is indeed even working yet...Try this: <?phpif (@mysql_connect("ServerName", "Username", "Password")) echo "Successfully Connected to Database";else echo "ERROR Connecting to Database";?> Replace the placeholders with the appropriate text and save this as <yourfilename>.php in your Apache web root directory.If this outputs one of the messages above as coded ("Success..." or "ERROR conn..."), PHP is working. MySQL can be determined to be working or not working by which message is displayed, of course ;)If you see this exact code output to your browser window OR if your browser prompts you to download the file, PHP is not working. Edited May 15, 2005 by epp_b Quote Link to comment Share on other sites More sharing options...
lewmur Posted May 15, 2005 Author Share Posted May 15, 2005 (edited) I'd suggest using plain code to figure out whether PHP and/or MySQL is indeed even working yet...Try this:Thanks. That proved that PHP is working but it isn't connecting to MySQL. I got the error message and not the code. I know MySQL itself is working because I can access the database using Navicat. Now I just have to figure out why PHP can't connect to it. Edited May 15, 2005 by lewmur Quote Link to comment Share on other sites More sharing options...
ross549 Posted May 15, 2005 Share Posted May 15, 2005 I thik there is a plugin for either MySQL or PHP, to link the two together in linux. Since I am not running Windows, I do not know f it is setup the same way. Quote Link to comment Share on other sites More sharing options...
Peachy Posted May 15, 2005 Share Posted May 15, 2005 Check your php.ini file and make sure to uncomment the mysql driver line. Double-check that you've copied all the php dll files into C:\Windows\System32. Quote Link to comment Share on other sites More sharing options...
lewmur Posted May 15, 2005 Author Share Posted May 15, 2005 Check your php.ini file and make sure to uncomment the mysql driver line. Double-check that you've copied all the php dll files into C:\Windows\System32.<{POST_SNAPBACK}> I had already done that. Would it help to try PHP 5? I chose 4.3 thinking it would be more stable. Or should I try an older version of Apache instead of Apache2? Quote Link to comment Share on other sites More sharing options...
lewmur Posted May 15, 2005 Author Share Posted May 15, 2005 (edited) Thanks. That proved that PHP is working but it isn't connecting to MySQL. I got the error message and not the code. I know MySQL itself is working because I can access the database using Navicat. Now I just have to figure out why PHP can't connect to it.<{POST_SNAPBACK}> I went ahead and installed PHP5 and now you're code is showing a successful connection. Hurray! So far. But Dreamweaver still isn't connecting. All of the documentation I can find only shows how to connect to a remote location and I'm trying to test this on my local machine. Edited May 15, 2005 by lewmur Quote Link to comment Share on other sites More sharing options...
lewmur Posted May 15, 2005 Author Share Posted May 15, 2005 I went ahead and installed PHP5 and now you're code is showing a successful connection. Hurray! So far. But Dreamweaver still isn't connecting. All of the documentation I can find only shows how to connect to a remote location and I'm trying to test this on my local machine.<{POST_SNAPBACK}> I found this site and carefully followed the instructions. It worked.http://computerbookshelf.com/phpdw/install1.php Quote Link to comment 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.