Win7 64bit under the latest apahe2.4.18+php7.0.2+mysql5.7.10 configuration

Source: Internet
Author: User
Tags system log win32 apache log

I. Description

Previously configured apache+php+mysql are reference online, generally there is no problem. Recently the company has a task needs to configure apache+php+mysql on the work computer, so to their various official online download the latest version, follow the online step by step, but found not so smooth, in the middle out of various problems, looking for information everywhere, fortunately finally solved, Now write it down for everyone's reference.

apache:http://httpd.apache.org/download.cgi version:2.4.18

php:http://www.php.net/downloads.php version:7.0.2

mysql:http://dev.mysql.com/downloads/mysql/version:5.7.10

  

  

Second, the configuration

1.php Configuration

First of all, because php7.0.2 is compiled with VC14, so need vc14 support, if your computer installed vs2015 can be ignored, otherwise you need to go here https://www.microsoft.com/en-US/download/ details.aspx?id=48145 download Vc14 as shown in:

  

Then, copy the Php.ini-development file in the PHP directory and rename it to php.ini as the default configuration file for PHP, and follow the steps below to modify it:

A. Adding an extension

Just remove the ";" in front of the corresponding line

Extension=php_curl.dll

Extension=php_gd2.dll

Extension=php_mbstring.dll

Extension=php_mysqli.dll

Extension=php_pdo_mysql.dll

Extension=php_pdo_odbc.dll

Extension=php_xmlrpc.dll

B. Configuration directory

To modify the extension directory, create a custom folder in the PHP directory, and then create two subfolders under the Custum folder, respectively, upload and session

; On Windows:
  Extension_dir = "D:/program files/apmserver/php-7.0.2-win32-vc14-x64/ext"

Modify the Upload directory

; Http://php.net/upload-tmp-dir
  Upload_tmp_dir = "D:/program files/apmserver/php-7.0.2-win32-vc14-x64/custom/upload"

Modify Session Directory

  Session.save_path = "D:/program files/apmserver/php-7.0.2-win32-vc14-x64/custom/session"

2.apache Configuration

Open the http.conf file in the Conf folder in the Apache directory and follow the steps to modify the configuration:

A. Setting up the Apache server root directory

  Define srvroot "D:/program files/apmserver/httpd-2.4.18-x64-vc11/apache24"
ServerRoot "${srvroot}"

B. Setting the Listening port

  Listen 80

The default is 80, by the Netstat-ano command to see if the system 80 port is occupied, if it is occupied, please replace a port that is not occupied

C. Loading the PHP module

Add the following #loadmodule vhost_alias_module modules/mod_vhost_alias.so:

  LoadModule php7_module "D:/program files/apmserver/php-7.0.2-win32-vc14-x64/php7apache2_4.dll"
  Phpinidir "D:/program files/apmserver/php-7.0.2-win32-vc14-x64/"
  AddType application/x-httpd-php. php. html. htm

Note: If the PHP7 module is loaded here

D. Installing Apache Services

Open command line cmd as Administrator, enter Apache's Bin directory, enter command: Httpd-k install-n apache24, display installation succeeded, but startup error

Look at the Apache log and find only this line:

[Sat Jan 23 20:33:04.958214 2016] [Ssl:warn] [PID 7236:tid 344] ah01909:localhost:443:0 server certificate does not include an ID which matches the server name

It's a warning, not a mistake, it doesn't seem to work.

Hit the service, right-start apache24, pop-up failure error prompt:

  

Open the System Event Viewer to view the system log and find the following error:

  

  The final step, this step is different from other versions, we need to add environment variables to PHP,

  

OK, start Apache24 Service, success. Enter localhost return in the browser

  

If you see this page, congratulations, success.

3.MySQL Configuration

  A. Modifying a configuration file

Copy the My-default.ini file from the MySQL directory and name it My.ini as the default profile, with the following main configuration:

[MySQL]
Default-character-set=utf8

[Mysqld]

Basedir = "D:/program files/apmserver/mysql-5.7.10-winx64"

DataDir = "D:/program files/apmserver/mysql-5.7.10-winx64/data"
Port = 3306

max_connections=200
Character-set-server=utf8
Default-storage-engine=innodb
Sql_mode=no_engine_substitution,strict_trans_tables

B. Installing the SQL Service

Add environment variable: Mysql_home value is the path to the MYSQL directory:

  

Add value to system variable path:%mysql_home%\bin;

From command line cmd into the bin path under MySQL directory, execute command mysqld--install, execute command net start MySQL service, result failed

This is because the mysql5.7 installation package without the data folder, even if we manually create the data folder, MySQL startup or failure, the online said can be copied from the lower version of MySQL can, I did not try.

But there is another way online: Execute command mysqld--initializ can automatically create the data folder and the initial information needed, pro-test can be.

C. Test MySQL

Because the password for the root account in the data generated in the previous step using the mysqld--initializ command is random, we have no way to get the root password directly, and we cannot log in to use MySQL

Workaround:

Open the My.ini configuration file and add this line at the end: #skip-grant-tables, which is to skip the authorization table when using MySQL, which means you can use MySQL without logging in. Save the My.ini and restart the MySQL service.

Enter commands on the command line MySQL, enter, enter MySQL

  

Modify root password: Update user set Password=password (' Your password ') where user= ' root ';
Don't forget to write to the database: Flush privileges;

Then quit MySQL, re-login: Mysql-u root-p, enter the password you just set, return to success.

Because of the MySQL security policy, it is not possible to use the account to perform other operations at this time, you must change the password again.

Change Password: SET PASSWORD for ' root ' @ ' localhost ' = PASSWORD (' Newpass '), this will allow you to enter the old password to execute.

  

To this all configuration succeeds!

Summarize the 2 points that are not the same as the previous old version:

System variables need to be added after 1.php configuration

2.mysql requires command to generate initialization data and requires manual root password change

  

Win7 64bit under the latest apahe2.4.18+php7.0.2+mysql5.7.10 configuration

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.