2012年6月20日 星期三

3. Install the MySQL 5.5.X w/ Apache+PHP

Install the MySQL 5.5.X w/ Apache+PHP
=====================================================================

(v5.5.25 tested)

STEP1:  Apache and PHP must be installed first...

STEP2:  download MySQL Community Server and execute the

        mysql-5.5.x-win32.msi

STEP3:  must be 'I accept the terms...'

STEP4:  recommend to use Custom setup so it can change to install to

        C:\MySQL

        just for easy accessing

STEP5:  use default features as options and install



STEP6:  launch the configuration wizard to configure the MySQL server

        most you can use default instance setting (just click next!)

        except 2 and 7...

        1. should be 'Detailed configuration', click 'Next'

        2. recommend to use 'Server Machine' when ask server type if

           it is alone  server machine otherwise should be

           'Developer Machine', click 'Next'

        3. should be 'Multifunctional Database', click 'Next'

        4. in InnoDB settings, it depends by you, click 'Next'

        5. should be 'Decision Support', click 'Next'

        6. in networking options, should be both enabled, click 'Next'

        7. recommend to use 'Best Support for Multilingualism' when

           as character set

        8. should be 'Install As Windows Service', click 'Next'

        9. enter a root password for accessing the MySQL server

        10. run execute in last step


To test if worked
---------------------------------------------------------------------

STEP7:  cut below (w/o separate line) as a simple PHP file into

        [Apache folder]\htdocs\sql.php

        the "password" must change to your MySQL root password

        ---------------------------------------
        <?php
           $link = mysql_connect ("localhost", "root", "password")
               or die ("Error: Could not connect!");
           print ("Connected successfully!");
           mysql_close ($link);
        ?>
        ---------------------------------------

STEP8:  open url http://127.0.0.1/sql.php in http browser to see if

        MySQL work








FAQ
=====================================================================

After open url http://127.0.0.1/sql.php

Q1: got the 'Fatal error Call to undefined function mysql_connect()'

    message

A1: it is because the PHP don't setup correctly, please check if PHP

    installed first

A2: also see Q2.A1/A2


---------------------------------------------------------------------
Q2: if it appeared as an empty page

A1: it is because the PHP don't load the MySQL extension, look STEP7

    in PHP section also check the php.ini in PHP installed folder,

    if the extension=php_mysql.dll uncommented

A2: the php.ini not loaded?

    check the [Apache folder]\conf\httpd.conf in the last lines if it

    appears

        #BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
        PHPIniDir "C:\PHP\"
        LoadModule php5_module "C:\PHP\php5apache2_2.dll"
        #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

    then this is strange! if it removes the last '\' of PHP folder in

    PHPIniDir, like PHPIniDir "C:\PHP"

    and RESTART the Apache service and the MySQL module loaded!

沒有留言:

張貼留言