Journey to PHP - Departure (php+apache+MySQL)

insert image description here

foreword

This article introduces in detail the installation of the independent version of php+apache+MySQL under the window, so that you can better understand their working principle, and be familiar with configuring the personalized environment you need later, let's take a look~

Prepare

  1. php-5.4.8
  2. Apache-2.2.22
  3. mysql-5.5.22
  4. Navicat-8.1 for MySQL(操作MySQL的工具
  5. Create a www folder in the root directory of D drive ( 也可在其它盘,本文案例默认D盘)

php installation

(*The installation path must be consistent with the modified content path)
Input file: php-5.4.8-Win32-VC9-x86.zip

Steps

  1. Extract it to a local D:/phpdirectory

  2. Find the file in the php folder php.ini-developmentand change the file name tophp.ini

  3. modify php.inifile

    Modifications:

  • ctrl+f to find php_curl,Remove the semicolon in front of this line of code
; extension=php_curl.dll
  • ctrl+f to find mysql,Remove the semicolon in front of these two lines of code
;extension=php_mysql.dll
;extension=php_mysqli.dll
  • ctrl+f to find php_gd2,Remove the semicolon in front of this line of code
;extension=php_gd2.dll
  • ctrl+f to find php_openssl,Remove the semicolon in front of this line of code
;extension=php_openssl.dll
  • ctrl+f to find php_pdo,Remove the semicolon in front of this line of code
;extension=php_pdo_mysql.dll

Apache installation

Input file: httpd-2.2.22-win32-x86-no_ssl.msi
operation steps

  1. click to install
  2. Next
  3. Server information fill in
    Network Domain: 指定服务
    Server Name: 指定服务名称
    Administrator's Email Addresss:指定邮箱
  4. Custom installation path
    D:\Apache2.2
    Next–>install–>finish

MySQL installation

  1. Create a MySQL folder in the root directory of the D drive
  2. Enter the MySQL installation package mysql-5.5.22-win32.msi
  3. Double click to install

insert image description here
Click Next to proceed to the next step of installation.
insert image description here
insert image description here
Select the installation type, there are Typical(默认), , Complete(完全)and Custom(用户自定义)three options. We choose Custom
insert image description here
Location to select MySQL under the D disk, and Next
insert image description here
insert image description here
is being installed... Please wait until the following interface appears
insert image description here
– "Next
insert image description here
Now the software installation is complete Now, the above interface appears, here is a very good function, mysql configuration wizard, no need to manually configure my.ini manually as before.
–” Next,
insert image description here
click “Next” to continue to the next step to continue. Select
insert image description here
the configuration method, Detailed Configuration(手动精确配置), Standard Configuration(标准配置), we choose to Detailed Configuration
insert image description here
select the server type, Developer Machine(开发测试类,mysql占用很少资源), Server Machine(服务器类型,mysql占用较多资源), Dedicated MySQL Server Machine(专门的数据库服务器,mysql占用所有可用资源), you choose according to your own type, generally, Server Machineit will not be too small, and it will not be full.
insert image description here

Select the general purpose of the mysql database, Multifunctional Database(通用多功能型,好), Transactional Database Only(服务器类型,专注于事务处理,一般), Non-Transactional Database Only(非事务处理型,较简单,主要做一些监控、记数用,对MyISAM数据类型的支持仅限于non-transactional), I have chosen here Transactional Database Only, press "Next" to continue
insert image description here

To InnoDB Tablespaceconfigure, is InnoDBto choose a storage space for the database file. If you modify it, remember the location, and choose the same place when reinstalling, otherwise the database may be damaged. Of course, it is no problem to make a backup of the database , not detailed here. I have not modified here, use the default location, just press "Next" to continue.
insert image description here

Select the general mysql visits of the website, the number of simultaneous connections, Decision Support(DSS)/OLAP(20个左右), Online Transaction Processing(OLTP)(500个左右), Manual Setting(手动设置,自己输一个数), I choose here Online Transaction Processing(OLTP), press "Next" to continue.
insert image description here

Whether to enable TCP/IP connection, set the port, if not enabled, you can only access the mysql database on your own machine, I enable it here, tick the front, , on this page, you can also choose " Port Number:3306Enable standard mode" ( Enable Strict Mode), so that MySQL will not allow minor syntax errors. Standard mode is used here because it reduces the possibility of harmful data entering the database. Press "Next" to continue.
insert image description here

Western encoding, choose the third one here, then select or fill in Character Set gbk,
press "Next" to continue.
insert image description here

Choose whether to install mysql as a windows service, you can also specify the Service Name (service identification name), whether to add the bin directory of mysql to ( Windows PATHafter adding, you can directly use the files under the bin without specifying the directory name, such as connection, "mysql.exe -uusername -ppassword;" is enough, you don't need to point out the complete address of mysql.exe, it is very convenient), I have ticked all of them here, and the Service Name remains unchanged. Press "Next" to continue.
insert image description here

This step asks whether to modify the password of the default root user (super administrator), we have modified the password here.
"New root password": root(we set the database password here as root)
"Confirm (enter it again)": root
"Enable root access from remote machines (whether to allow root users to log in on other machines, if you want to be safe, don't tick on, tick it if you want it conveniently)".
Finally, "Create An Anonymous Account (create an anonymous user, anonymous users can connect to the database, but cannot operate data, including query)", there is no need to tick here, the setting is complete.
Press "Next" to continue
insert image description here

Confirm that the settings are correct, if there is a mistake, press "Back" to return to check. Press "Execute" to make the settings take effect
insert image description here

Then open cmd, enter the command line input net start mysql, it prompts that the service name is invalid, and check the service list. If it has been started, the MySQL service is installed successfully.

net start mysql

carriage return
insert image description here

Navicat installation (attached)

We also need to install a tool to operate MySQL Navicat for MySQL
Get the Navicat for MySQL installation package navicat8_mysql_cs.exe, double-click to install
insert image description here
insert image description here
insert image description here

Select the installation directory and click "Next".
insert image description here
insert image description here
insert image description here

insert image description here
insert image description here
insert image description here
-"registration success
insert image description here

Click Connect to create a new connection:

  1. 输入连接名
  2. Password: root
    –> sure
    insert image description here
    insert image description here
    all installations are complete!

Apache+php integration

Modify Apache conf- " httpd.conffile

  • Add code at the bottom
LoadModule php5_module "D:/php/php-5.3.5/php5apache2_2.dll"
PHPIniDir "D:/php/php-5.3.5"
AddType application/x-httpd-php .php .phtml

注:D:/php/php-5.3.5指向php安装路径
View port
Generally, the default is 80, if it is occupied, modify it to other
Listen 80( 此处修改端口号)

  • Modify the php.ini file in php,Remove the semicolon in front of this line of code, and change "ext" to "D:/php/ext"
    ctrl+f findextension_dir
; extension_dir = "ext"  

D:/php is the php file package address

Verify Apache+php

Create a file under the www file. The content of index.phpthe file
is:

<?php 
phpinfo();
?>

Restart Apache, enter in the browser and http://127.0.0.1/index.php
the version form shown in the figure below appears, indicating that the installation is successful.
insert image description here
Finish!

Six years of code, no thinking, unforgettable
6 years of senior front-end supervisor, share technical dry goods, project practical experience, interview guidance,
follow bloggers to not get lost~

Guess you like

Origin blog.csdn.net/qq_37215621/article/details/126861680
php