Getting started with PHP: Install the PHP working environment separately in Windows systems
1. What is LAMP?
Linux+Apache+Mysql+Perl/PHP/Python is a set of open source software commonly used to build dynamic websites or servers. They are independent programs, but because they are often used together, they have more advantages. With higher and higher compatibility, they form a powerful web application platform. With the vigorous development of the open source trend, open source LAMP has formed a tripartite trend with J2EE and .Net commercial software, and the software development project has a low investment cost in software, so it has attracted the attention of the entire IT community. In terms of website traffic, more than 70% of the access traffic is provided by LAMP, and LAMP is the most powerful website solution.
2. Install the Apache server
There are many kinds of web servers. The mainstream ones include Apache server, Lighttpd server, Tomcat server, IBM WebSphere server, Microsoft IIS, etc. What we are going to install today is the most commonly used web server in the world, and its market share The Apache server has a rate of about 60%.
2.1. Download address: http://httpd.apache.org/
2.2. Installation method: http://jingyan.baidu.com/article/0964eca227a0fb8285f536a3.html
3. Install MySql database
There are two main ways to install MySql, one is the decompressed version and the other is the installation version. The difference between the two is that the decompressed version requires manual configuration of some parameters. If you need to register an Oracle account to download the cloud official website, it is recommended to download one directly from Baidu.
3.1. Installation method of decompressed version of MySql: http://michael-wong.iteye.com/blog/976381
3.2. Installation method of MySql installation version: http://wenku.baidu.com/link?url=e56Y84enINF6OjWyUMq1Oq4I_0INv6LZQVEmip1XLukPLKX4qnJHHwRkU8kVR6vd1zZfgjQTwLF3moUQI6M2WusQPGvZQYHzB7 BK8ucYzWm
4. Install PHP
Here we choose to download the php-5.2.6-Win32.zip version. The reason why we do not download the latest version 5.5.7 is because there is no information on the Internet about the installation method of this version, which is different from the installation of previous versions. Are there any differences in methods? So choose this version. Of course, you can also try to install the latest version. But for beginners, is it necessary to pursue the new version blindly?
4.1. Download address: http://pan.baidu.com/share/link?shareid=822524062&uk=2318720427
4.2. Specific installation:
4.2.1. Unzip the downloaded file and put it in a directory, such as C:lampphp5.2.5
4.2.2. Load php into the apache server as a module:
4.2.2.1. Find the httpd.conf file under conf in the Apache installation directory and open it. For example, mine is C:lampapacheconfhttpd.conf;
4.2.2.2. Find the code
4.2.3. What else should we do? That is to tell the server what the suffix of the php file is. Only in this way can the apache server know to parse files with the .php suffix.
4.2.3.1. Still in the httpd.conf file, find the line AddType application/x-gzip .gz .tgz. The reminder here is that if the line of code you find has a # sign, then Indicates that this line is commented out. You have to uncomment this line of code, and then insert it below it: AddType application/x-httpd-php .php .phtml
4.2.4. Next, we need to specify the location of the php configuration file. How to specify it? Or add a line below the code you just inserted: PHPIniDir "c:/lamp/php5.2.5". The case does not matter. Remember to change the path to your own. Of course, if the path is the same as mine, don't worry about it. .
4.2.5. Do you feel that there are a lot of things to configure? Don’t worry and finish it immediately. You will be able to see the test page later. The version I downloaded does not have the php.ini file. I don’t know if the new version does. So what should I do? Simple, we go to the PHP installation file to find the php-ini-recommerded file, and rename this file into the php-ini file. My address here is: C:lampphp5.2.5php-ini-recommerded.
http://www.cnblogs.com/roucheng/
4.3. Test whether the installation is successful
Now we write a text file (C:lampapachehtdocstest.txt) in htdocs in the apache server installation directory, and write a few lines of code in this text file:
phpinfo();
Just write two lines of code? Yes, you just need to write it as written. After saving the file, change its suffix to .php.
4.4. Start the apache server and start testing the program
4.4.1. There are two ways to start. One is to use its own tools to start, the other is to directly enter net start apache2.2 in the cmd command window and press Enter.
4.4.2. Open the browser and enter the URL: http://localhost/ and press Enter. You will see the sentence "It works!", which means that your service has started normally. Then enter http://localhost/test.php in the address and press Enter. You will find a very beautiful PHP configuration information page, which proves that you succeeded, cool!
4.4.3. Do you think the incident ends here? Now we just connected the Apache server and php, but php still can't access the MySql database? It is not enabled by default and must be enabled manually.
4.4.3.1. Go to the php installation directory (mine is C:lampphp5.2.5libmysql.dll) and find libmysql .dll file and copy it to the C:Windows directory. It should be noted that you can also set environment variables. The method is to find the path in the environment variable, and then add the path to the PHP installation directory at the end.
4.4.3.2. Now php can find mysql, but we want to expand the connection library of mysql by finding the php.ini file in the php installation directory And open it, find the line of code ;extension=php_bz2.dll in the file, and insert a line above it and write: extension_dir="c:/lamp/php5.2.5/ext", this What does it mean? It means that the location of the extension library installed on my machine is here. The specific location will be determined based on the actual situation on your computer.
4.4.3.3. Still find two lines of code in this php.ini file extension=php_mysql.dll, extension =php_mysqli.dll, remove the ; sign in front of these two lines, which means that this function is turned on or enabled. So how do you know whether the correct configuration is successful? It's very simple. Restart the server now and visit http://localhost/test.php again. At this time, you will find the information as shown below on the page
5. Install php optimization software
Do you feel that the configuration is too much? It doesn’t matter. You don’t have to do this step. But after installing this thing, the performance of your PHP project can be improved by 40%. Think about it yourself!
5.1. Software name: ZendOptimizer-3.3.3-Windows-i386.zip
5.2. Download address: http://pan.baidu.com/share/link?shareid=3641277684&uk=1277919049&fid=1806952306
5.3. Installation method: This version is installed in the next step, so I won’t demonstrate it. If you don’t know yet, just use Baidu! I'm tired after typing for too long.
Note: Starting from PHP5.3, ZendOptimizer has been officially changed to Zend Guard Loader, (official address: http://www.zend.com/en/products/guard/downloads)
(End)