http://www.neilcrookes.com/2008/10/30/installing-apache-php-mysql-and-phpmyadmin-on-windows-xp-the-right-way/ 에서 참조
Installing Apache, PHP, MySQL and phpMyAdmin on Windows XP… the right way
The best step-by-step guide to the recommended way of installing and configuring Apache, PHP, MySQL and phpMyAdmin on Windows XP… ever! 😉
There is no need to copy files to your windowssystem32 folder. All files stay where they are supposed to. Upgrading is easy. Configuration is minimal.
Apache
- Go to http://httpd.apache.org/download.cgi and under the section titled “Apache HTTP Server x.x.xx is the best available version” click on the link labelled “apache_x.x.xx-win32-x86-openssl-0.9.8i.msi” next to the text “Win32 Binary including OpenSSL 0.9.8i (MSI Installer)”. Save the file to your computer and when it has finished downloading double click the icon and run the installer.
- Select the following options:
– Network Domain: localhost
– Server Domain: localhost
– Administrator’s Email Address: <your email address>
– Install Apache for all Users, on port 80 as a serviceSelect the Custom setup type:
No need for the Build Headers and Libraries or the Apache docs (these are available online) at http://httpd.apache.org/docs/2.2/.
- Test the installation by going to http://localhostin your browser, you should see the text “It works!”:
- Pick a folder where you are going to store all the files for all the sites you are going to develop, then, if it doesn’t already exist, create it. I use the folder “C:sites“.
- Click on Start > All Programs > Apache HTTP Server 2.2 > Configure Apache Server > Edit the Apache http.conf Configuration File.
- Search for the text “DocumentRoot” and replace the default value, which is something like “C:/Program Files/Apache…/htdocs” with the folder where you are storing all your sites, e.g. “C:/sites”, noting the forward slash this time. Just below this is a “Directory” directive containing an attribute for the default DocumentRoot value too. Also change this to “C:/sites”.
- Search for the “DirectoryIndex” directive, and add “index.php” to the list of files to run if no file is specified in the request URI.
- If your sites use Apache’s mod_rewrite module, you’ll need to enable this. To do so, search for the text mod_rewrite and uncomment the line by removing the preceding hash symbol.
- Search for the “http-vhosts.conf” include line and remove the preceding “#” to uncomment it and include the file.
- Add following to the bottom, then save and close the file:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
PHP
This installation method unzips the PHP files rather than using an installer. This is the method of installation recommended on php.net as it means you don’t have to move files into the windows/system32 directory, which means upgrading is easier and it gives you more insight into the configuration process, empowering you to modify the configuration as and when you need to.
- Go to http://www.php.net/downloads.php under the section titled ”Windows Binaries” click on the link labelled “PHP x.x.x zip package“. Save the file to your computer and when it has finished downloading extract to “C:php”.
- Add “C:php” to system path by right clicking on My Computer, select “Properties” option, click on the “Advanced” tab, click on the “Environment Variables” button, select the “Path” option in the list of “System Variables” fieldset then click the “Edit” button. Add “C:php” to the end of the existing list, note that values are separated by a semi-colon. Restart your computer.
- Copy “C:phpphp.ini-recommended” to “C:phpphp.ini“.
- Open php.ini and search for “extension_dir“. Replace the default with the path to your php ext directory, “C:/php/ext/”.
- Locate the long list of extensions and enable the ones you want by removing the preceding semi-colon at the start of each line, e.g. extension=php_mysql.dll.These are likely to be gd2, soap, mysqli and maybe some others.
- As this is a development installation, you will want to set display_errors = On. Otherwise, you wouldn’t be able to see the errors in your code ;-).
- Restart Apache by clicking on the Apache Service Monitor icon in the System Tray and clicking “Apache2″ > “Restart”.
- Create the file “C:sitesphpinfo.php” containing:
<?php phpinfo(); ?>
- Test the installation by going to http://localhost/phpinfo.phpin your browser, you should see this:
MySQL
- Go to http://dev.mysql.com/downloads/mysql/5.0.html#win32
- Under the section titled “Windows downloads” click the link labelled “Pick a mirror” next to the text “Windows ZIP/Setup.EXE (x86)”.
- Under the forms click the link labelled “No thanks, just take me to the downloads!“.
- Click on a link labelled “HTTP” from a mirror close to you.
- Save the file to your computer and when it has finished downloading extract the Setup.exe file, then run it.
- If you prefer using the online help, choose the “Custom” installation type and do not install the documentation.
- Keep the “Configure the MySQL Server now” check box checked and click the “Finish” button.
- Choose the following settings:
- Press the “Execute” button.
phpMyAdmin
- Go to http://www.phpmyadmin.net/home_page/downloads.php
- Under the section titled “Downloads” click on the link labelled “english.zip” for the latest version of phpMyAdmin.
- When the file has finished downloading, extract it to “C:sitesphpMyAdmin“.
- Open the httpd-vhosts.conf file located in the “confextra” directory where Apache was installed and replace the dummy host VirtualHost directives with the following:
<VirtualHost *:80>
DocumentRoot "C:/sites/phpmyadmin/phpMyAdmin-3.0.1-english"
ServerName phpmyadmin.localhost
ErrorLog "logs/phpmyadmin.localhost-error.log"
CustomLog "logs/phpmyadmin.localhost-access.log" common
</VirtualHost>
then save the file and restart apache. - Open the file “C:WINDOWSsystem32driversetchosts” with Notepad and add the line
127.0.0.1 phpmyadmin.localhost
- Copy the config.sample.inc.php file to config.inc.php and open it.
- Amend the lines as follows:
$cfg['Servers'][$i]['auth_type'] = 'config';
...
$cfg['Servers'][$i]['extension'] = 'mysqli'; - You can use phpMyAdmin installed locally to administer remote databases servers too. To do this, add the following to your config.inc.php file in the Servers configuration section:
$i++;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = 'other_host';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['user'] = 'your_user';
$cfg['Servers'][$i]['password'] = 'your_pass'; - Go to phpmyadmin.localhostin your browser, you should see this:
- Note, you can disable the warning about using a root account with no password by commenting the line in main.php as follows:
//trigger_error($strInsecureMySQL, E_USER_WARNING);