Windows PHP APACHE mysq full configuration _php Tips

Source: Internet
Author: User
Tags anonymous flush php programming phpmyadmin

After a recent period of crazy PHP programming, the Windows platform under the PHP configuration can be considered deep feeling, at first I used a button to install the fool bag, but consider the installation version of the Fool package has been behind, in the real manual configuration of the PHP environment encountered many problems , after consulting a lot of information and try, finally configured successfully. Now, I will be my configuration experience and share with you, I believe you can solve the configuration of the PHP environment of confusion.

First of all, I use the software version.

PH P 5.1.6

Apache 2.0.59 ( Note: TheApache 2.2.X version must have plugins installed to support PHP 5)

MYSQL 5. 0.24a

Okay, now began to install, I first installed php5, directly unzip the file to C:\php ( installed to where there will be no impact, with personal hi, all the paths in this article to my installation path, please install on their own machine when the attention to modify for their own path) , and then install APACHE, I directly loaded into the C-packing directory, in the installation process , there will be 3 text boxes, above two input your native IP, the bottom of the input of your EMAIL, OK. Installation completed. Edit now ... \apache group\apache2\conf\ under the httpd.conf file. Open the file in Notepad and add the last two lines of code:

LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php. php

i set up a www directory in the c:\ directory to store My site files in the httpd.conf find such a word:documentroot "C:/apache2/htdocs " changed to documentroot "c:/www". In this way, the home directory is set to C:\www. If you do not want to change the home directory location, you may not change this item.

to modify the default home page for a directory:
Find directoryindex behind the file name you want to set the home page, such as:index.html index.php .

Language priority, locate the following statement

languagepriority zh-cn zh-tw en ca cs da de el eo et fr he hr it ja ko ltz nl nn no pl pt p T-BR Ru SV
Put the Chinese (zh-cn zh-tw) Part of the cut to the front (that is, the corresponding in the original file
Partially changed to the above.

There's nothing else to change. Apach 's configuration is here. Then talk about the configuration of PHP.

copy php.ini-dist to C:\windows under the name of php.ini (installed php have done it)
And then modified a few places:

Find post_max_size = 8M under Data handling

This is the maximum size of post data that PHP will accept , and can be changed to 20M.

Find extension_dir= under Paths and directories

Here is the location of the PHP search extension Library, set its path to the location of the Extensions folder, which is changed to:

extension_dir= "C:\php\ext"

upload_max_filesize = 2M is found under file uploads to allow maximum file size to be uploaded

Can be changed to 20M.

dynamic Extensions
Font size= "3" > This is the php Extension Settings section, which lists all the supported extensions for php, preceded by a semicolon note Span lang= "en-us" >
php configuration does not support expansion, we can remove the semicolon and let php support the extension The
php extensions
Remove the semicolon before the following sentence

; Extension=php_mbstring.dll
; Extension=php_dba.dll
; Extension=php_dbase.dll
; Extension=php_filepro.dll
; Extension=php_gd2.dll
; Extension=php_imap.dll
; extension=php_mysql.dlL

Here PHP.ini the end of the configuration. And then a very important point will be

c:\php\libmysql.dll , c:\php\ext\php_mysqli.dll

Copy to c:\windows\system32 The so php5 MYSQL

Restart APACHE, create a new Notepad file in the home directory test input in

<?php

Phpinfo ();

?>

after saving modify suffix name Span lang= "en-US" >php http://127.0.0.1/test.php php version information, yes, so php mysql

Step One: Double-click the First dialog box that appears for the. exe file to be selected is the Setup Type, which is
installation Type, here we can choose Custom, according to their own needs to install components and configure the installation path

Click Next, right click on the dialog box to appear several hard disk shape icons, according to their own needs to choose the installation components,

Click on the Change button at the bottom right of the window to modify the installation path, after setting, click Next to install the installation to the most
there will be one of the following dialog boxes here three options are:

1: If you don't have a mysql.com account, choose the first one and create a new free mysql.com account

2: If you have a mysql.com account, select the second one, and fill in the registered mailbox name and password

3: Skip this step

we choose the first one .

There will be three dialog boxes at a time, and the parts of the three dialog boxes that have * must be filled in.
In order, the mailbox name, password, confirm password, the number one name, lastname,zip code,
Country, province name. The name of China, the province selected other or N/A can 4.1.x and 4.0.x series version
This is a big difference is that after the installation is not running the MySQL folder under the winmysqladmin.exe to


mysql

First you will see a window that has two options, namely detailed configuration and standard configuration,
Small application Select the second item to click next appears after the following dialog box, which is important, certain
mysql41 in the Drop-down menu, otherwise it will not start normally, the following option is whether to apply the command line,
next after setting the Database Password dialog box, the middle right and the following options are
next after the
Now the final dialog box, click execute button The database server is started, followed by four tick mark
click finish End installation

test the connection after installing the phpMyAdmin, and if it appears

#1251-client does not support authentication protocol requested by server; consider upgradingMySQLClient
in the Start menu, locate the MySQL command-line tool that you just installed, and then type the password for root as follows:
MYSQL>&NBSP; Update mysql.user set password = old_password ( ' just set the root password '
->&NBSP; where host =  ' localhost '  AND  user =  ' root ';
mysql>  flush privileges; ( note flush with spaces span>

Then browse "Http://localhost/phpmyadmin",OH yeah! Test Success!

After talking about MYSQL 4.1 due to the use of UTF8 caused by the garbled problem solution. First of all, in the new database when the character set must choose UTF8, in phpmyadmin New database, create the left side of the button, there is a drop-down list, the default is " Sorting ", choose UTF8. You will find that the data in the table is not a question mark.

But the output of the page is still a question mark, do not hurry then in the PHP statement to be changed:

In mysql_connect (.....) Connection parameters ); after adding mysql_query ("SET NAMES ' GBK '"), Linux under GBK change to UTF8

But if a lot of web pages, this is not very troublesome, so I write PHP in the operation of all the database to write a class such as:

Class db{

... . contains some database call methods ... .

  // Create a database connection and select the appropriate database

function Createcon () {

mysql_connect (.....) ); mysql_query ("SET NAMES ' GBK '");

}

}

In this way, to change a place on it, is it convenient? Oh, I believe you read this article in the PHP Environment is difficult to configure, well, write so much, exhausted, I wish you all a happy learning!

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.