Apache + php + mysql running environment, apachemysql
We recommend that you use Apache2.4 + php5.6 + mysql5.5 + phpmyadmin4.4.4
Refer to: http://jingyan.baidu.com/article/fcb5aff797ec41edaa4a71c4.html; http://jingyan.baidu.com/article/4dc408488ecb82c8d946f1dc.html
1. apache2.4, download link: http://www.apachelounge.com/download/
V11 and 64-bit are also recommended.
2. decompress the downloaded Apache package and copy it to d: \ Apache24 \.
3. Modify D: \ Apache24 \ conf \ httpd. conf.
Change the ServerRoot line to ServerRoot "D:/Apache24". The double quotation marks are the location where your apache is placed.
4. Modify D: \ Apache24 \ conf \ httpd. conf.
Modify DocumentRoot according to the following content:
DocumentRoot "d:/Apache24/htdocs"
<Directory "d:/Apache24/htdocs">
5. It doesn't matter if the ServerAdmin of Row 3 is changed;
Remove the "#" before the ServerName in line 3;
Line 3: DocumentRoot "c:/Apache24/htdocs" changed to DocumentRoot "D:/Apache24/htdocs"; // root directory of the website
Change <Directory "c:/Apache24/htdocs"> to <Directory "D:/Apache24/htdocs">;
Change DirectoryIndex index.html to DirectoryIndex index.html index. php index.htm in Row 3. // support more response pages
Line 3 ScriptAlias/cgi-bin/"c:/Apache24/cgi-bin/" changed to ScriptAlias/cgi-bin/"D:/Apache24/cgi-bin /"
Change <Directory "c:/Apache24/cgi-bin"> to <Directory "D:/Apache24/cgi-bin">
6. Run d: \ apache24 \ bin \ httpd.exe-k uninstall-n "servicename" to uninstall the service. Servicename is the name in the Service and can be customized .)
7. Configure php to support apache: (copy all dll files in php5 (including dll files in the ext folder) to the system32 folder in Windows, for example, C: WINDOWS \ system32. This step is to allow the windows system to obtain the dll file run by PHP. The significance is the same as that of specifying the system environment variable, but to make it simple, copy the dll file directly to the windows System directory. If your system is 64-bit, copy the 32-bit dll file to the C: \ Windows \ SysWOW64 directory)
Http://windows.php.net/download/#php-5.5download php5.5vc11 x64 Thread Safe version, add it to the system environment variable PATH; D: \ php \ ext, which takes effect after restart. Decompress the php file package and place it in the D directory named php. Enter the php folder and find the following two files and rename them to php under any backup. ini {set date. timezone = PRC; Set extension_dir = "D:/php/ext"; Set max_execution_time = 0 to run timeout and never expire, put the extension file in the ext folder. Add the following lines in apache conf to add support for php5:
# Php5 support
LoadModule php5_module D:/php/php5apache2_4.dll
AddType application/x-httpd-php. php. html. htm (set php File Parsing)
# Configure the path to php. ini
PHPIniDir "D:/php"
Copy the modified php. ini file and paste it to the ssleay32.dll and libeay32.dll files in c: \ windows or the php folder without copying them to the windows directory on drive c ()
} Finally, you can use the phpinfo () function to test whether php + apache is connected.
8. Install mysql manually (download mysqlCommunity Server 5.6.13 ------Http://dev.mysql.com/downloads/mysql/DownloadWindows (x86, 64-bit), ZIP ArchiveVersion or Baidu cloudHttps://pan.baidu.com/share/link? HYPERLINK id = 2303223802 HYPERLINK "https://pan.baidu.com/share/link? Did id = 2303223802 & uk = 3029771834 "& HYPERLINK" https://pan.baidu.com/share/link? Required id = 2303223802 & uk = 3029771834 "uk = 3029771834Download extract codeW60l)
Http://blog.csdn.net/q98842674/article/details/12094777 (reference)
Configure or create the my. ini file {
[Client]
Port = 3306
Default-character-set = utf8
[Mysqld]
Port = 3306
Character_set_server = utf8
Basedir = D: \ Program Files \ MySQL \ mysql-5.6.13-win32
# Decompress the Directory
Datadir = D: \ Program Files \ MySQL \ mysql-5.6.13-win32 \ data
# Decompress the data directory in the directory (skip this step)
SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES
[WinMySQLAdmin]
D: \ Program Files \ MySQL \ mysql-5.6.13-win32 \ bin \ mysqld.exe
}
Right-click my computer> Properties> advanced system Settings> Environment Variables
Click new Under System Variables
Input variable name: MYSQL_HOME
Input variable value: D: \ mysql
# This is the custom extract directory of mysql.
Find path -- edit -- add it to the end; D: \ mysql \ bin (corresponding directory of the bin folder)
Check whether there is any data directory under the mysql directory;
If the data directory exists, ignore this vertex;
If not, open win + r and run. Enter cmd to enter the command window;
Enter the drive letter of the mysql instance. For example, d:
ThenCdToMysqlOfBinDirectory and execute the following statement:Mysqld -- initialize-insecure -- user = mysql; dataThe directory is generated successfully.------Or executeMysqld -- initialize-insecureGenerate password-lessRootUser. CommandsMysqld -- initializeAutomatically generate a random passwordRootUser. Use the first command to generate a password-lessRootUser. (PS: Because the extractedMysqlFolder does not existDataFolder.DataFolder. We recommend that you useMysqld -- initialize-insecureCommand)
Register mysql as a windows system service (or copy the my. ini file to the windows folder on drive C)
1From the consoleMySQLDecompressBinDirectory:
2) Enter the service installation command:
Mysqld installMySQL -- defaults-file = "D: \ mysql \ my. ini"OrBinDirectoryMysqld -- installStatement InstallationMySQLService
#DecompressMy. iniFile
After the installation is successful, a message is displayed, indicating that the service is successfully installed.
#Note:My. iniPut files inMySQLUnder the root directory after decompression
#Command:Mysqld remove
3) StartMySQLService
Method 1:
Run the following command to start the service:Net start mysql
Method 2:
Open management toolsService, findMySQLService.
Right-click Start or click Start on the left to start the service.
9. Enter mysql and change the password
Under the mysql directory, edit the my-default.ini
Add a line of skip-grant-tables under [mysqld] to cancel the password temporarily;
1. Restart mysql ,;
2. Enter mysql-uroot-p and press Enter. If you are prompted to enter the password, press Enter;
, 3. After the login is successful, enter update mysql. user setauthentication_string = password ('000000') where user = 'root' and Host = 'localhost'; change the password to 123456 first;
4. Enter flush privileges, refresh, and save;
5, delete the skip-grant-tables saved just added in the my-default.ini;
6, exit; or quit; exit mysql;
7. Restart mysql;
8, use the new password login: mysql-uroot-p123456 enter to log on successfully;
9. Place the required php extension dll in the ext folder.
SetApacheAnd the computer.
Write such a piece of codeTestAlreadyMysqlThe connection is normal. The Code is as follows:
<? Php
$ Link = mysql_connect ('localhost', 'root ','');
If (! $ Link) echo "fail ";
Else echo "success ";
Mysql_close ();
?>
SaveMysqltest. php. Save inWebUnder the root directory.
Last usePhpmyadminWhy can't I log on to the database? See (Http://jingyan.baidu.com/article/495ba841ef412d38b30edeb2.html)