PHP version of the special, special miscellaneous, want to build a set of PHP running environment is not an easy thing, a little inattentive to encounter a pit, on a problem stuck half a day. This article attempts to describe the pits that may be encountered in version selection when PHP is selected:
Windows under
First look at the operating system version, if it is the Windows download here: http://windows.php.net/download/
See if the operating system is 32-bit or 64-bit? If it is 32-bit, choose the version with "x86", if it is 64-bit, select the version with "x64".
and see what the Web server is? In the case of the IIS family, choose the version with "Non thread safe", and if it is the Apache httpd series, choose the version with "Thread Safe".
If it is Apache httpd also see how this binary version is compiled, there are three types of compilation, namely: VC6, VC9, VC11 (respectively, for Visual C + + 6, Visual C + + 2008, Visual C + + 2012). Here is the trouble: PHP official version 5.5 has been compiled with VC11, 5.4 is compiled with VC9. But the latest version of Apache HTTPD is still compiled with VC6. This means an amazing fact: the official version of Apache httpd and the official version of PHP are incompatible! When I took a lot of time to find out the truth, my mouth was going to be scared off. What is the apache+php of the existing Windows? can use VC11 to compile Apache httpd, but this is too frustrating, PHP official recommended to download the third party packaged Apache HTTPD version, recommended this site: http://www.apachelounge.com/download/, Need to note: This VC11 does not support XP, if you like me have XP nostalgia, the highest can only upgrade to 5.4.24,5.5 is compiled with VC11, and VC11 does not support XP and 2003.
Know the above several principles and then look at the download file name is very clear, the following to do exercises to consolidate it, look at the two file names represent what version?
1 VC11 x64 Non Thread Safe
2 VC9 x86 Thread Safe
Answer:
1 versions used by IIS for 64-bit Windows that are compiled with VC11
2 version used for 32-bit Windows with VC9 compiled with Apache httpd
Linux under
If it's the Linux department, download the PHP source here: http://cn2.php.net/downloads.php
Unlike the above version of Windows, the download here can not be used directly, just PHP source code, to install the need to compile their own, to compile the need to install GCC, make and a bunch of compiled software. See the documentation that says./configure, make, make install, for the PHP version of the source.
Compiling PHP yourself is even more troublesome, relying on a lot of libraries, waiting for people to fall into the pits also have a lot, I will say in another article. If you have trouble, you can find the compiled version, specifically the distribution of the official software library. The following is a popular Ubuntu and CentOS department as an example of the separate description;
Deb Package Management (Ubuntu, Debian)
With Apt-cache search PHP command can search a lot of results, we need to be "php5", The complete command is: Apt-get install PHP5
This is obviously not always applicable, because there is a version number 5 in the command, and the future of PHP6 is not known.
If you want to install a command-line PHP engine in the shell, install this package
Apt-get Install PHP5-CLI
RPM Package Management (Fedora, RedHat, SUSE, CentOS)
Yum Install PHP
If it is a PHP command line, install yum install PHP-CLI
Spit a groove, even choose the version to know so much (the full name of this article should be called "PHP Version selection: From the beginning to Mastery", haha), said so much, has not started to really configure the PHP environment, really just choose version only, technology is really too hard.
The above describes the PHP version selection, including PHP, version of the content, I hope that the PHP tutorial interested in a friend to help.