Home >Backend Development >PHP Tutorial >PHP version selection discuz x3.2 php version Tongda oa php version latest version
There are so many PHP versions and they are very complicated. It is not easy to set up a PHP operating environment by yourself. If you are not careful, you will encounter a pit and get stuck on a certain problem for a long time. This article attempts to explain one by one the pitfalls that may be encountered in PHP version selection:
Under Windows
First look at the version of the operating system. If it is Windows, download it here: http://windows.php.net/download /
Look at whether the operating system is 32-bit or 64-bit? If it is 32-bit, choose the version with "x86"; if it is 64-bit, choose the version with "x64".
Then look at what the WEB server is? If it is the IIS series, choose the version with "Non Thread Safe". If it is the Apache httpd series, choose the version with "Thread Safe".
If it is Apache httpd, it also depends on how the binary version is compiled. There are three compilation types: VC6, VC9, and VC11 (representing Visual C++ 6, Visual C++ 2008, and Visual C++ 2012 respectively). Here's the trouble: the latest official version of PHP, 5.5, has been compiled with VC11, and 5.4 has been compiled with VC9. But the latest version of Apache httpd is still compiled with VC6. This means a surprising fact: the official version of Apache httpd and the official version of PHP are actually incompatible! When I discovered this fact with great effort, my mouth almost dropped in shock. So how does the existing Apache+PHP under Windows work? You can compile Apache yourself with VC11
httpd, but this is too much trouble. PHP officially recommends downloading the third-party packaged version of Apache httpd. We recommend this site: http://www.apachelounge.com/download/. One thing to note: this VC11 does not support XP. If If you have XP nostalgia like me, you can only upgrade to 5.4.24. 5.5 is compiled with VC11, and VC11 does not support XP and 2003.
After knowing the above principles, it will be very clear when you look at the downloaded file names. Let’s do some exercises to consolidate. What version do these two file names represent?
1 VC11 x64 Non Thread Safe
2 VC9 x86 Thread Safe
Answer:
1 Compiled with VC11 for 64-bit Windows, version used with IIS
2 Compiled with VC9 for 32-bit Windows, with Apache The version used by httpd
Linux
If you are Linux system, download the source code of PHP here: http://cn2.php.net/downloads.php
Different from the Windows version above, what you download here cannot be used directly , it is just the source code of PHP. To install it, you need to compile it yourself. To compile it, you need to install a bunch of compilation software such as gcc and make. I saw that ./configure, make, and make install are mentioned in the document, which refers to the source code version of PHP.
Compiling PHP yourself is even more troublesome. There are a lot of dependent libraries and there are a lot of pitfalls waiting for people to fall into. I will talk about it in another article. If you find it troublesome, you can find a compiled version, specifically the official software library of each distribution. The following takes the popular ubuntu system and centos system as examples to illustrate respectively;
deb package management type (ubuntu, Debian)
Using the apt-cache search php command can search for many results. We need "php5". The complete command is: apt-get install php5
This is obviously not applicable forever, because the command contains version number 5, and no one knows what will happen with PHP6 in the future.
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, Just install yum install php-cli
I’m going to complain, you need to know so much to even choose a version (the full name of this article should be "PHP version selection: from entry to proficiency", haha), after saying so much, I haven’t yet When it comes to actually configuring the PHP environment, it’s really just a matter of selecting the version. It’s really hard to do technical work.
The above introduces the PHP version selection, including PHP and version content. I hope it will be helpful to friends who are interested in PHP tutorials.