In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "how to build a php environment under win". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to build a php environment under win.
The method of building php environment under win: 1, download apache and configure it; 2, download PHP and extract it to the php folder in the wamp directory; 3, download and install mysql;4, and modify the configuration file.
This article operating environment: Windows7 system, PHP5.6 version, Dell G3 computer.
Build the running environment of php under window10
The php integrated environment (eg:phpstudy,xampp, etc.) has always been used for development before, and I have never tried to use php+mysql+apache to build an independent PHP environment locally, so I suddenly want to try to build it today to see what trouble I will encounter on the road. First of all, the building tools we need are:
Windows operating system (my computer is win10)
Apache
MySQL
Php
First of all, I installed apache.
Installation of 1.Apache:
The download address of apache is http://www.apachelounge.com/download/, according to your computer configuration.
Download whether it is 32-bit or 64-bit according to your computer configuration. Here I created a wamp folder on disk D and unzipped the downloaded apache in this directory. Next, run cmd as an administrator, then step into the d:\ wamp\ Apache\ bin directory and execute the httpd-k install command in that directory
The first time I executed the httpd-k install installation command, I encountered the problem in the image above, because the default path in the httpd.conf configuration file is wrong, you can manually rewrite it to your actual path.
In the process, I also encountered the situation that apache could not be installed. Later, I checked that the previously installed apache had been set up as a system service, just delete it.
The delete operation is as follows (note also as an administrator):
Action: enter services.msc in the start bar to open the list of system services: as shown in the figure
Of course, I also encountered other problems during this period:
Right-click the Apache2.4- "property in the image above
Find out whether the path to the executable file is wrong or the path to the previous integration environment (which I modified, of course).
This is modifiable as follows:
Enter "regedit" in the start search bar to open the registry and find the desired service Apache2.4 under HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Services\ and change its "ImagePath" key to the actual path. Of course, the introduction here is only for situations where your apache cannot be started, if you implement the
Sc delete apache2.4
You do not have to perform the above operation on this command. When you finish executing httpd-k install and the following appears, your local apache has been installed successfully
The error in the red box can be ignored according to my judgment.
Of course, you can also solve this kind of mistake:
Localhost.localdomain. The solution to this error in Set the 'ServerName' directive globally to suppress this message apache startup is to change the ServerName in apache's configuration file httpd.conf to an available domain name or configure ServerName localhost:80 as follows
If you type http://localhost, in your browser, if the following page appears, your apache has been installed successfully.
Install reference link reference link
Installation of 2.php
Download address: https://windows.php.net/downloads/releases/
Then extract the downloaded file to the php folder in the wamp directory (do not download the non-thread-safe version, which does not have an extension file for phpX (5) apache2_4.dll), which should be used when configuring apache.
3. Download MySQL
Next is to download the MySQL link address https://dev.mysql.com/downloads/mysql/
I downloaded the MySQL5.7 version. Download 32bit or 64bit according to your operating system.
Extract the downloaded files to the mysql folder in the wamp directory.
4. Modify the configuration file
Open the httpd.conf file under the D:/wamp/apache/conf folder
Find the line # LoadModule xml2enc_module modules/mod_xml2enc.so and add something below this line
PHPIniDir "C:/wamp/php5.6/" LoadModule php5_module "C:/wamp/php5.6/php5apache2_4.dll"
Then find the line AddType application/x-gzip .gz. TG and add it below.
AddType application/x-httpd-php .php
The configuration of apache is complete.
Then open the file name of the php.ini-developement file in the D:/wamp/php folder to php.ini, and then edit the file
Extension_dir = ". /"
; On windows:
Extension_dir = "d:/wamp/php5.6/ext"
Date.timezone = Asia/Shanghai
Uncomment this line and fill in the actual path of the ext folder.
Then open some php extension files.
The next step is to configure MySQL. Open and go to the D:/wamp/mysql directory to create a new my.ini configuration file, and paste the content.
[mysql] # set mysql client default character set default-character-set=utf8 [mysqld] # set port 3306 port = 3306 # set mysql installation directory basedir=D:\ wamp\ mysql # set mysql database data storage directory datadir=D:\ wamp\ mysql\ data # maximum number of connections max_connections=200 # the character set used by the server defaults to the 8-bit coded latin1 character set character-set-server=utf8 # Default storage engine default-storage-engine=INNODB that will be used when creating new tables
Run cmd as an administrator, go to the D:/wamp/mysql/bin directory to install the MySQL service, and enter mysqld install (note that it is mysqld, not mysql).
The command line displays the line, indicating that the installation was successful
Next, type mysqld-- initialize to create the data folder, otherwise the MySQL service cannot be started later
Then type net start mysql to start the MySQL service
Enter mysql-u root-p, and then enter the password to connect to the MySQL service
The following error may occur
The MySQL version downloaded here does not support password-free authentication by default. We need to manually set and modify it, open the my.ini file, and add a sentence at the end of the file:
Skip-grant-tables
Then restart MySQL (net stop mysql/net start mysql), where you can connect without a password, but many features are limited. First connect to MySQL, and then select the user database to change the password of the root user.
Update user set authentication_string=password ("password you set") where user = "root"
Disconnect the MySQL connection, delete the skip-grant-tables just added in the settings file my.ini, restart the MySQL service, and log in with the password you set.
At this point, I believe you have a deeper understanding of "how to build a php environment under win". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.