当前位置:网站首页>The installation method of apache+mysql+php running environment under Windows

The installation method of apache+mysql+php running environment under Windows

2022-06-24 06:14:00 User 1685462

1. install Apache

a) Double click on the file Apach_2.2.8_win32-x86-no_ssl.msi, Pop up the welcome screen . single NEXT Button , Enter into License Agreement( license agreement ) Interface .

b) The user needs to agree to the interface To continue the installation . Choose I accept the terms in the license agreement After the radio button , single click NEXT Button , Pictured 1 Shown , Enter the program description and description interface .

chart 1

c) After browsing the description and description of the program , single click NEXT Button to enter Server Information Interface , Pictured 2 Shown .

chart 2

d) Server Information The interface requires the user to fill in the domain name 、 Server name and Administrator Email. stay Network Domain Enter your domain name below ( such as :goodwaiter.com), stay Server Name Fill in your server name below ( such as :www.goodwaiter.com, That is, the host name plus the domain name ), stay Administrator's Email Address Fill in the contact email address of the system administrator ( such as :[email protected]), The above three pieces of information are for reference only , The contact email address will be provided to visitors in case of system failure , Three pieces of information can be filled in at will , Invalid ones are OK . Finally, there are two radio buttons , If the default first radio button is selected , This means that the server is open to everyone , And the port number of the server is 80, This is the recommended option . The second radio button is that the server is only available to the current user , And the server port is 8080. Select the first option here , And then click NEXT Button , Get into Setup Type( install type ) Interface , If 3 Shown .

chart 3

e) stay Setup Type The installation type can be selected in the interface , Yes Typical Default installation ,Custom User defined installation Two installation methods , Here, just keep the custom installation options , single click NEXT Button , Get into Destination Folder( Path selection ) Interface , Pictured 4 Shown . The select installation options interface appears , As shown in the figure , Left click to select “Apache HTTP Server 2.0.55”, choice “This feature, and all subfeatures, will be installed on local hard drive.”, namely “ This part , And its sub parts , All installed on local hard disk ”.

chart 4

f) single click Change Button to select the installation path . Here the path is set to “D:\Apache2.2\”, single click NEXT Button .( You have chosen by yourselves , It is generally recommended not to install it on the same disk as the operating system , In case the operating system breaks down , The restore operation will Apache The configuration file is also cleared .)

g) Enter the file installation interface . This is a Apache The last step in the installation , The program starts to install the files . After installation , single click Finish Button to end the installer .

h) After installation ,Apache The server will turn on automatically . An icon will appear in the lower right corner of the desktop , At present Apache When the server starts , The icon style is

; Server not started , The icon style is

.

Click the small icon

, You will see the opening and closing functions of the server ; You can also right-click the small figure mark , In the pop-up shortcut menu Middle selection Choose Open Apache Monitor command , open Apache Monitoring program .

i) When the server is up , Finally, you need to test the server . Open a browser window , Enter in the address bar “http://127.0.0.1/” perhaps “http://localhost”, Press Enter The key will see the following figure 5 The interface of ( All the tutorials I have seen say that the following interface appears , But I haven't seen this interface yet , Just see two English words It Works, But it doesn't matter ).

chart 5

2. install PHP5

Apache After the server starts successfully , Next you need to install PHP5. install PHP5 The operation steps are as follows :

① take PHP5 Installation file php-5.2.6-Win32.zip Extract to the appropriate directory , Such as C:\php-5.2.6-Win32、D:\php-5.2.6-Win32 etc. . Here will be placed D:\php-5.2.6-Win32 Under the table of contents , Directory structure as shown 2.1 Shown .

chart 2.1

② Put the directory All under dll File replication To the system disk Windows\System32 Under the table of contents (Windows 2000 Our users are winnt\system32 Under the table of contents ).

③ Will file php.ini-dist Copy to the system disk Windows Under the table of contents , And rename it php.ini.

④ open “;extension=php_mysql.dll” This business , Place the preceding semicolon “;” Get rid of , such ,PHP You can support MySQL Database .

⑤ Save and exit ,PHP5 End of installation , But now Apache The server has not been able to resolve php5 file , Because there are still some settings on the server side . Please refer to page for how to set 4 Chapter 《 To configure Apache and PHP5》.

3. install MySQL

Open the download mysql The installation files mysql-4.1.14-win32.zip, Double click extract , function “setup.exe”, The following interface appears

mysql The setup wizard starts , Press “Next” continue

Choose the installation type , Yes “Typical( Default )”、“Complete( Completely )”、“Custom( User customization )” Three options , We choose “Custom”, There are more options , It's also convenient to get familiar with the installation process

stay “Developer Components( Developer section )” Left click , choice “This feature, and all subfeatures, will be installed on local hard drive.”, namely “ This part , And its sub parts , All installed on local hard disk ”. Above “MySQL Server(mysql The server )”、“Client Programs(mysql Client program )”、“Documentation( file )” It works the same way , To ensure that all files are installed . Point selection “Change...”, Manually specify the installation directory .

Fill in the installation directory , My is “D:\mysql”, It is also recommended not to put it in the same partition as the operating system , This prevents system backups from being restored , Data is cleared . Press “OK” continue .

Back to the interface , Press “Next” continue .

Confirm the previous settings , If there is any mistake , Press “Back” Go back to redo . Press “Install” Start installation .

Installing , Please wait a moment , Until the following screen appears

This is to ask if you want to register a mysql.com Account number , Or log in with an existing account mysql.com, Generally not , Point selection “Skip Sign-Up”, Press “Next” Skip this step .

Now the software installation is complete , The interface above appears , Here's a great feature ,mysql Configuration wizard , You don't have to be the same as before , My own manual messy configuration my.ini 了 , take “Configure the Mysql Server now” Tick on the front , spot “Finish” End the software installation and start mysql Configuration wizard .

mysql Configuration wizard startup interface , Press “Next” continue .

Choose configuration mode ,“Detailed Configuration( Manual precise configuration )”、“Standard Configuration( Standard configuration )”, We choose “Detailed Configuration”, It is convenient to be familiar with the configuration process .

Select the server type ,“Developer Machine( Develop test class ,mysql Take up little resources )”、“Server Machine( Server type ,mysql Occupy more resources )”、“Dedicated MySQL Server Machine( Dedicated database server ,mysql Occupy all available resources )”, We choose according to our own type , Generally choose “Server Machine”, Not too little , It's not going to fill up .

choice mysql The general purpose of the database ,“Multifunctional Database( Versatile , good )”、“Transactional Database Only( Server type , Focus on transactions , commonly )”、“Non-Transactional Database Only( Non transactional , Simpler , Mainly do some monitoring 、 For counting , Yes MyISAM Data type support is limited to non-transactional), Choose for your own use , I choose “Transactional Database Only”, Press “Next” continue .

Yes InnoDB Tablespace To configure , Is to InnoDB Database file select a storage space , If it changes , Remember the location , Choose the same place when reloading , Otherwise, the database may be damaged , Of course , It's OK to make a backup of the database , Not detailed here . I don't have any changes here , Use the default location , Directly by “Next” continue

Choose your general website mysql Traffic volume , Number of simultaneous connections ,“Decision Support(DSS)/OLAP(20 about )”、“Online Transaction Processing(OLTP)(500 about )”、“Manual Setting( Manual settings , Lose a number by yourself )”, I choose here “Online Transaction Processing(OLTP)”, Your own server , It should be enough , Press “Next” continue

Is it enabled? TCP/IP Connect , Set port , If not enabled , You can only access it on your own machine mysql Database , I'm here , Put the tick on the front ,Port Number:3306, Press “Next” continue

This is more important , That's right mysql The default database language code is set , The first one is western language coding , The second is multi byte general purpose utf8 code , It's not our universal code , Here's the third one , And then in Character Set Where to choose or fill in “gbk”, You can also use it “gb2312”, The difference is gbk It has a large capacity , It includes gb2312 All Chinese characters of , And added traditional Chinese characters 、 And other messy words —— Use mysql When , Run once before executing the data operation command “SET NAMES GBK;”( Just run it once ,GBK Can be replaced with other values , Depending on the settings here ), You can use Chinese characters normally ( Or other words ) 了 , Otherwise, Chinese characters cannot be displayed normally . Press “Next” continue .

Choose whether or not to mysql Installed as windows service , You can also specify Service Name( Service ID name ), Whether or not to mysql Of bin Add directory to Windows PATH( After joining , You can use it directly bin The files under the , Instead of pointing out the directory name , For example, connection. ,“mysql.exe -uusername -ppassword;” That's all right. , Don't point out mysql.exe The full address of , Very convenient ), I've ticked everything here ,Service Name unchanged . Press “Next” continue .

This step asks if you want to change the default root user ( Super management ) Password ( The default is empty. ),“New root password” If you want to modify , Just fill in the new password here ( If it's a reload , And the password has been set before , Changing the password here may cause an error , Please leave it blank , And will “Modify Security Settings” Remove the front tick , Change the password after the installation and configuration ),“Confirm( Again )” Please fill in again , Prevent wrong input .“Enable root access from remote machines( Whether to allow root Users log on to other machines , If you want to be safe , Don't hook up , If you want convenience , Just hook it up )”. Last “Create An Anonymous Account( Create an anonymous user , Anonymous users can connect to the database , Can't manipulate data , Including inquiries )”, Generally, there is no need to tick , Setup complete , Press “Next” continue .

Make sure the settings are correct , If there is any mistake , Press “Back” Go back to check . Press “Execute” Make settings effective .

Setup complete , Press “Finish” end mysql Installation and configuration —— Here's a common mistake , Just can't “Start service”, Generally appeared in the previous installation mysql On , The solution , First, make sure that the previous installation mysql The server was completely uninstalled ; No words , Check if you follow the steps above , Whether the previous password has been changed , Follow the instructions above ; If it still doesn't work , take mysql Install under directory data Folder backup , Then delete , After installation , Will install the generated data Folder deletion , Backup data Move the folder back , Restart again mysql Just the service , In this case , Maybe you need to check the database , Then fix it once , Prevent data errors .

4. To configure Apache and PHP5

Want to use Apache Server support PHP file , Will be in Apache Configuration file for httpd.conf Make some settings in ..Httpd.conf The location of the file is Apache In the root directory conf Under the table of contents , The main settings are as follows .

* find LoadModule Configuration block , stay LoadModule Add the following information at the end of :

LoadModule php5_module D:\php-5.2.6-Win32\php5apache2_2.dll

File results after adding Pictured 4.1 Shown .

chart 4.1

* modify DocumentRoot Parameters can be modified Apache Server master Root directory . Original root directory The position is Apache2.2\hotdocs Catalog , The user can specify any location , Such as :

DocumentRoot "D:/htdocs/"

stay DocumentRoot The lower distance of 28 The position of the line , Have an act <Directory "D:/Apache2.2/htdocs/">, Change to <Directory "D:/htdocs/".( Be careful DocumentRoot Keep consistent with the parameter values here )

* Add hope Apache The server can recognize PHP Extension . The added code is as follows :

AddType application/x-httpd-php.php

Add location as shown in the figure 4.2 Shown .

* Default display page .Apache The default display page for is index.html. in other words , When the server does not specify a file , In the first place to find index.html, If you find index.html, Then the server will load the file , Otherwise, the list of files in the directory will be displayed . Add one here PHP Default page index.php. The changed code is as follows :

DirectoryIndex index.html index.php

( In fact, you don't have to “index.html”, such as “test.php” etc. , Fine )

* modify Apache Port number .Apache The port number of is 80. Modify selection term Listen Value , You can modify the port number , If changed to 82, Then the changed code is as follows ( Generally, it doesn't change ):

Listen 82

After the above configuration is completed , restart Apache The server can .

原网站

版权声明
本文为[User 1685462]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/07/20210723184705185B.html