Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PHP 5.28 ---- no connection ----> MySQL 5.3 on IIS5.1

  • 17-09-2009 04:59PM
    #1
    Registered Users, Registered Users 2 Posts: 139 ✭✭


    For sh!ts & giggles, I have been playing around with an old PC at home which is running XP Pro.

    I have successfully (in so far as they are all working individually) installed the IIS windows component, PHP 5 and MySQL5 and even have my newly acquired domain name pointing at this setup
    I just can't get my php pages to connect to the database either on localhost, LAN or WAN. I know MySQL is running - MySQL Administrator is able to connect and I have created tables. I can also make an ODBC connection to the database from MS Access, but the php pages are returning a 500 Internal Server Error. This is the connection code:

    [PHP]
    <?php
    $hostname="localhost";
    $mysql_login="my_username";
    $mysql_password="my_password";
    $database="my_database";

    if (!($db = mysql_connect($hostname, $mysql_login , $mysql_password))){
    die("Can't connect to database server.");
    }else{
    // select a database
    if (!(mysql_select_db("$database",$db))){
    die("Can't connect to database.");
    }
    }
    ?>
    [/PHP]

    This is similar to a connection I am using on a hosted website which works fine. It doesn't work at home... :(
    I have also tried to get Dreamweaver to make a connection:eek:, but the same 500 Error is returned.

    Anyone had any similar experiences setting up IIS, PHP & MySQL successfully and can point a noob in the right direction


Comments

  • Registered Users, Registered Users 2 Posts: 139 ✭✭Bald? er, dash!


    Right, solved it myself...

    The php installation was manual, so you have to edit the php.ini file in c:\windows to remove the semicolon from in front of the required dll
    ;extension=php_mssql.dll
    extension=php_mysql.dll
    ;extension=php_mysqli.dll
    

    and then moving that .dll from the ext folder in the php installation folder to the installation root folder (e.g. from c:\php\ext\ to c:\php\) Reboot and away you go - at least that's what worked for me.

    Mods can lock if appropriate!


Advertisement