PDA

View Full Version : PHP and MySQL issue


Red Blaze
03-03-2009, 02:30 AM
Ok, this is the first time I successfully installed Apache 2.2, PHP5, and MySQL 5 onto my computer for a developing environment so I don't have to upload constantly. Laptop to be more specific, Windows XP Home Edition.

It renders php very well, except for pages that have mysql involved. For instance, I have have page that has a config.php included at the very top with the following content.


<?php
session_start();

$dbhost = '**.***.***.**';
$dbuser = '**********';
$dbpass = '***********';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');

$dbname = 'databasename'; //real database name was changed...
mysql_select_db($dbname);

$clientId = 2;

define("CLIENTID", 2);
define("PATH", "/my/home/path/*****/html/");
?>


As I commented out line by line, I came to realize that $conn = mysql_connect is the culprit. I used This Website (http://www.mydigitallife.info/2005/10/15/install-web-server-in-windows-xp-with-apache2-php5-and-mysql4-part-1/) and followed everything as close as possible. Considering they were using MySQL 4, and not 5.

What I want to know is why won't it tell me an error. It just gives me a flat out blank page. Any ideas to lighten my way? x.x

TigerC10
03-03-2009, 03:35 AM
You probably haven't enabled the PHP extension for MySQL - or if you have, you might have set the extension directory improperly.

Check out this page:
http://www.php-mysql-tutorial.com/wikis/php-tutorial/installing-php-and-mysql.aspx

And go to the "Modifying PHP Configuration File ( php.ini )" section.

Dismounted
03-03-2009, 04:35 AM
Check the error_log file of your Apache installation. It should tell you the error. Additionally, you should enable error_reporting in PHP's configuration for debugging purposes.

Red Blaze
03-03-2009, 04:45 PM
Alrighty, I followed the link showed to me and I've got it set up right. Now I turned on my laptop today and I got this new little problem.

"httpd.exe: Could not reliably determine the server's fully qualified domain name, using ***.***.*.* for ServerName"

And now, when I got to a page that has a mysql connect involved, Apache2 crashes.

I recently got this error today just as I started my laptop. This wasn't showing last night.

========================

Maybe it'll help if I post where Apache, PHP and MySQL are installed in.

Apache: C:\Server\Apache 2
PHP C:\php
MySQL C:\Server\mysql

in php.ini, which is in Apache 2 directory, I have two edits:
extension_dir = C:\php\ext\
and
extension=php_mysql.dll <- just uncommented

And this is the "Error Signature" I get when Apache crashes:

szAppName : httpd.exe szAppVer : 2.2.11.0 szModName : php5ts.dll
szModVer : 5.2.9.9 offset : 0000ac7a

TigerC10
03-03-2009, 11:15 PM
Sounds like you don't have your httpd.conf file set up properly.

http://httpd.apache.org/docs/1.3/windows.html#use

Check your ServerName variable and make sure it's set to "localhost" or "127.0.0.1" or even your machine's IP address. That's the URL you'll be using to access your test site (http://localhost/ etc.) in your browser. Do not set this your your actual domain name, as your domain name most likely does not point to this test environment.

vbplusme
03-04-2009, 03:18 AM
ServerName localhost:80

its commented out by default...