After a recent fanatical periodPHPProgramming, rightWINDOWSUnder the platformPHPThe configuration is very touching. At the beginning, I used the one-click installation fool package, but considering that the installation version of the fool package has lagged behind, so I am really manually configuring it.PHPI encountered many problems in the environment. After reviewing many materials and trying, the configuration was finally successful. Now, I will share my configuration experience with you. I believe it can solve the problem of your configurationPHPConfusion of the environment.
First, let’s talk about the software version I use.
PH
APACHE
MYSQL
OK, now I'll install it firstphp5,Decompress the file directly toC:\php(There will be no impact where you install it. According to my personal favorite, all the paths in this article are based on my installation path. Please note that when installing on your machine, please make sure to modify it to your own path.), then installAPACHE, I installed it directlyCIn the root directory, during installation,Will appear3Type the text box above two to your local machineIP, enter yours at the bottomEMAIL,OK. Installation is complete. Edit now..\Apache Group\Apache2\conf\Nextdocument. Open the file with notepad,Add these two lines of code at the end:
LoadModule php5_module "C:/php/"
AddType application/x-httpd-php .php
I am hereC:\A directory has been createdwwwThe directory is used to store my site files,This sentence was found in:DocumentRoot "C:/Apache2/htdocs"Change toDocumentRoot "C:/www". In this way, the home directory is set toC:\www. If you do not want to change the home directory location, you can do not change this item.
Modify the default homepage of the directory:
turn upDirectoryIndex Write the file name you want to set as the home page later, such as: wait.
Language priority,Find the following statement
LanguagePriority zh-CN zh-TW en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv
Put Chinese (zh-CN zh-TW) cuts the part of the file in front (that is, puts the corresponding one in the original file
The part is changed to the above.
There is nothing else to change.APACHThat's all for the configuration. Let's talkPHPconfiguration.
Bundle-distCopy toC:\windows Renamed below (installedphpHave done all of them)
Then several modifications:
existData HandlingFind it belowpost_max_size = 8M
This isPHPWill acceptPOSTThe maximum data size can be changed to20M。
existPaths and DirectoriesFind it belowextension_dir=
What is set here isPHPSearch for the location of the extension library and set its path toextensionsThe location of the folder is changed to:
extension_dir= "C:\php\ext"
existFile UploadsFind it belowupload_max_filesize = 2M, the maximum file size allowed to upload
Can be changed to20M。
Dynamic Extensions
here it isPHPExtended settings section, listedPHPAll extensions can be supported, with semicolon notes in front
Release, indicating thatPHPThe configuration does not support extensions, we can remove the semicolon.PHPSupport this extension
The following are some commonly used and practicalPHPExtended
Remove the semicolons in front of the following sentences
;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
Go hereThe configuration is over. Then a very important point will
C:\PHP\,C:\PHP\ext\php_mysql.dll,C:\PHP\ext\php_mysqli.dll
Copy toC:\Windows\system32Next, thisPHP5Only supportMYSQL。
Get backAPACHE, create a new notepad file in the home directorytestEnter in
<?php
phpinfo();
?>
After saving, modify the suffix namePHP. Enter in the browserhttp://127.0.0.1/Did you see PHPVersion information, yes, that's itPHPThe configuration is completed. Next installMYSQL。
Step 1: Double-tap.exeThe first dialog box to be selected when a file appears isSetup Type That is
Installation type, here we can chooseCustom, install components and configure installation path according to your needs
ClickNext, right-click the dialog box to display several hard disk-shaped icons, select the installation components according to your needs.
Click on the bottom right side of the windowChangeThe button changes the installation path. After setting it, clickNextStart installing to the best
There will be the following dialog box. The three options here are:
1: If you don't haveAccount, choose the first one, create a new free oneaccount
2: If you haveSelect the second account and fill in the registered email name and password
3: Skip this step
Let's choose the first one
Next, three dialog boxes will appear at a time, among which the* The part of the number must be filled in.
In order, the email name, password, and confirm password;first name ,last name;postal code,
Country, provincial name. Country selectionchina, provincial name selectionother or N/AJust4.and4.Series version
One big difference is that it is not running after installation mysqlUnder the folderCome
After starting the server, you set the options, but there is a setting process.
Step 2: Setting upMYSQL
First of all, you will see a window like this, where there are two options, namely detailed configuration and standard configuration.
Just select the second item for a small application and clickNextThe dialog box below appears afterwards. It is important here, it must be
To select from the drop-down menuMySQL41, otherwise it cannot start normally. The following options are whether to apply the command line,
It's best to select clickNextAfter setting the database password dialog box, the options on the right and the following are:
Allow remote control and whether to allow anonymous account login. For security, don’t choose it, clickNextAfterward
The last dialog box is available, clickExecuteThe database server is started, and four checks appear in sequence
ClickFinishEnd installation
InstallPHPMYADMINAfter testing the connection, if it appears
#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
existFind the newly installed one in the Start menuMYSQLCommand line tool, enterrootAfter the password, type the following words:
mysql> UPDATE SET Password = OLD_PASSWORD(‘The just setROOTpassword')
-> WHERE Host = 'localhost' AND User = 'root';
mysql> FLUSH PRIVILEGES;(NoticeFLUSHThere are spaces after)
Then browse“http://localhost/phpmyadmin”,OH YEAH! The test succeeded!
Let's talk aboutMYSQL 4.1Later, due to the adoptionUTF8Solutions to the garbled problem caused. First of all, you must select the character set when creating a new database.UTF8,existPHPMYADMINUnder the Create Database, there is a drop-down list on the left of the Create button. The default is "Sorting". SelectUTF8. You will find that the data in the table is no longer a question mark.
But the output of the web page is still a question mark, don't rush to continuePHPChanges to the statement:
existmysql_connect(…Connection parameters);Add afterwardsmysql_query("SET NAMES 'GBK'"); GBK is changed to UTF8 under linux
But if there are many web pages, it is not very troublesome, so I'm writingPHPWhen writing all database operations into a class such as:
class db{
….Contains some database call methods....
//Create a database connection and select the corresponding database
function createcon(){
mysql_connect(…);mysql_query("SET NAMES 'GBK'");
}
}
In this way, just change one place, isn’t it very convenient? Haha, I believe you will never realize it after reading this articlePHPThe environment is difficult to configure, OK, I’m so tired to write so much, I wish you all a happy study!