Php and mysql

Hi,

I have been using php and mysql for several years and recently my XP installation died and I couldn’t revive it. So I have a new installation of Windows 7 Ultimate.

I have installed PHP 5.3 and IIS following instructions from this forum. That works. I have also installed MySQL 5.6 and that works.
However, PHP and MySQL don’t work together. I have been through the configurations time and time again but I just cannot see where the problem lies.

It manifests itself from the browser not recognising the CSS scripts.

calling localhost/phpinfo.php gives

PHP Warning: phpinfo() [<a href=‘function.phpinfo’>function.phpinfo</a>]: It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Europe/London’ for ‘0.0/no DST’ instead in C:\inetpub\wwwroot\phpinfo.php on line 3

calling localhost/index.php gives

Pre-connect

This comes from my connect script:

ini_set('display_errors',1);
error_reporting(E_ALL);

echo '<p style="color: black;">Pre-connect</p>';

$dbcnx = @mysql_connect('localhost', 'root','mancity1' );

if (!$dbcnx) {

	exit( '<p>Unable to connect to server</p>');

}

echo '<p style="color: black;">Connected Server</p>';



if(!@mysql_select_db('ut_db')) {

	exit('<p>Unable to locate utilities database.</p>'); 

}

echo '<p style="color: black;">Connected Database</p>';

So I know it is calling the script. The display statements are in there temporarily while I sort out this problem.
It does not matter whether I replace the mysql_connect function with anything else, it displays the same characteristics and it won’t go any further. I know this is going to be something obvious but please help.

Thanks,

Steve

You need to set your timezone in the php.ini file

Thank you,

I’ve set timezone to:

date.timezone = “Europe/London”

That has solved one problem but the other problem still exists.

Steve

You might not have the mysql_* extension installed. In any case you should be migrating over to either the mysqli_* extension or PDO as the mysql_* is deprecated as of the current php version and will very likely be removed in the next php version.

Also remove the @ as they are surpressing any errors

Hi @steveob200653;

Take a look at how PHP Manual recommends the use of mysql_connect();

http://php.net/manual/en/function.mysql-connect.php

When the connection fails mysql_error() shows why you cannot connect.

Thank you,

I have now set the extension in php.ini and it is now working. I will migrate the whole caboodle to use either mysqli_or PDO when I’ve either found or written a program to replace strings. Brilliant, a language that changes the syntax and isn’t backwards compatible. I’m very impressed!

Steve