Configure the Web server with Apache+php+mysql in Windows Environment (rookie edition)

Source: Internet
Author: User
Tags config ini mysql mysql in php file valid phpmyadmin root directory

Write very painful, although the quality of the article is not high, or wish to reprint please indicate the source , thank you.

I have no one around to teach, are all the information they find on the internet, and QQ to find a friend to ask.

Believe that I like this article, the situation should be the same as I do, because no one to teach, the Internet to find information.

Until now, there are a number of problems I have not figured out, I believe there will be a lot of problems I have not found.

I put my experience out and share with you, hope the master can give advice.

Software version:

Apache 2.0.54 (To install files is install)

PHP 5.0.4 (To install the file is zip, decompression after a lot of files of the kind, do not install)

MySQL 4.1.12 (to be install)

phpMyAdmin 2.6.3-rc1 (no matter from where, after decompression must be a folder, inside a lot of files)

The above software can go to their official homepage to download, also can go to www.skycn.com download.

First step: Install the Software

Install Apache 2.0.54 (in which directory, as you like)

Decompression PHP 5.0.4 (after decompression, I changed the directory name to PHP5)

Install the MySQL 4.1.12 (when installing, I was all the way next, one step, is to enter the root account password, this password is very important, otherwise your

MySQL may not use it)

Decompression phpMyAdmin 2.6.3-rc1 (after decompression I changed the folder name to a simple directory name admin)

I am referring to other online heroes of the time, heroes in order to take care of our rookie, always put the installation of the directory also said very clearly.

After a few days of my experiments, I feel that there is no need to do so, as long as you set some of the server parameters, the path to write understand it.

Let's say how to set up this server.

Step two: Set up the software

When setting up the software, it is important to distinguish between good "/" and "\", and when used incorrectly, your server will not function properly.

When you modify the server default settings, if the default settings are "/", you use the "/", if the default settings for "\", you use "\".

First from the simple start, set MySQL.

Use Notepad to build a file, the filename is My.ini, the contents are as follows:

[Mysqld]
Basedir=x:\xxxxx\mysql\
(Here is the directory where you install MySQL, that is, when you enter this path, you see the "Bin" directory and the "data" directory, etc.)
Datadir=x:xxxxx\data\
(This is your data storage directory, that is, you later build the database files are in this directory, preferably set into the MySQL directory of that data directory)
Default-character-set=gbk
set-variable=max_connections=1000

I pretended to be WinXP, I put the My.ini file in the system disk C:\windows\ directory, if your Windows directory already have My.ini file, you can change the original, You can also cover the past with the above written. If your system is Win2000 you may want to overwrite the system disk c:\winnt\ directory.

Set Apache.

In your installed Apache directory, there is a conf directory, in this directory, there is a "httpd.conf" file. All we do is modify this file.

In this file, every line that starts with "#" is not valid, and if you want your settings to work, remove the "#" from the beginning.

Find ServerRoot. Set it to your Apache installation directory, and mine is ServerRoot "D:/apache group/apache2"

Find DocumentRoot. Set him up as the root of your site, and mine is DocumentRoot "D:/apache group/web."

Find DirectoryIndex. Change it to DirectoryIndex index.php index.html Index.html.var So, your website

The default home page is index.php, if no index.php system will automatically find index.html as the default home page.

On the last line of the file, add this paragraph:

scriptalias/php/"D:/apache group/php5/"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php-cgi.exe"

In addition to these content, only add this paragraph of the first line of "D:/apache group/php5/" into your extracted PHP directory path, the others do not change. PHP seems to have two ways to install to Apache, one in the form of CGI Plug-ins, one in the form of the Apache module, which is apparently installed as a CGI plugin.

After you change the above, the relevant settings for Apache are set.


Finally said the php.ini file setting

In this file, all the beginning words are ";" , are not valid, so if you want your settings to take effect, put the line at the beginning of the row you modified ";" Remove.

In your extracted PHP folder, there is a file "php.ini-dist", rename the file to "PHP.ini", and then copy it to the system directory and modify the file. WinXP's system directory is C:\Windows, The Win2000 system directory is C:\Winnt

Find Extension_dir segment, change to Extension_dir = "D:/apache Group/php5/ext", which is the directory containing a large stack of. dll files in your PHP directory.

Find Extension=php_mysql.dll This line, put this line before the ";" Remove and let this line take effect, that is, let your PHP support MySQL.

Find Session.save_path this line, set into Session.save_path = "x:/xxx/" The role of this sentence, so that the resulting session file, are stored in the directory you set up x:/xxx/, otherwise your system directory, There will be many session files.

Find Session.auto_start segment, change to Session.auto_start = 1. If your session function is not available later, change the 1 to 0.

I installed it as a CGI, 1,session can be used.

So far, the server configuration is complete.


Besides, phpMyAdmin's set.

Move your extracted phpmyadmin to your site's root directory,

That is, set Apache in the httpd.conf file in the time of the DocumentRoot "D:/apache group/web" directory.

Locate the config.inc.php file in the phpMyAdmin directory and use Notepad to open it. Find one line of code

$cfg [' Servers '] [$i] [' auth_type '] = ' config '; authentication method (config, HTTP or cookie

Based)?
$cfg [' Servers '] [$i] [' user '] = ' root '; MySQL User
$cfg [' Servers '] [$i] [' password '] = '; MySQL Password (only needed

Modify $cfg[' Servers ' [$i] [' password '] = ';

Write the root password you set up when you installed MySQL. $cfg [' Servers '] [$i] [' password '] = ' password ';


Then, restart your Apache server (if not reset, all changes will not take effect), enter in the browser

http://localhost/myphpadmin/, if the phpMyAdmin interface is displayed, your Web server is set up.


Postscript:

In this article, I installed PHP as a CGI plugin for Apache.
In fact, I want to be installed in the way of the Apache module, but in the installation of the module, the session always appear wrong,
So here is not written, and so I study well, must write out and share with you.

Also want to have heroes see this section of the article, can inform the module installation, how to change the php.ini in the session related settings.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.