Home  >  Article  >  Backend Development  >  What server is php running on?

What server is php running on?

青灯夜游
青灯夜游Original
2019-10-12 11:39:116761browse

What server is php running on?

There are generally two commonly used web servers for php: 1. apache; 2. nginx.

Apache is the world's number one web server software. It can run on almost all widely used computer platforms and is one of the most popular web server-side software due to its cross-platform and security features.

Nginx (engine x) is a high-performance HTTP and reverse proxy web server, and also provides IMAP/POP3/SMTP services.

Let’s take a look at the differences between apache and nginx:

1. The core difference between the two is that apache is a synchronous multi-process model, one connection Corresponds to one process; nginx is asynchronous, and multiple connections can correspond to one process. nginx handles static files well and consumes less memory. But there is no doubt that apache is still the current mainstream and has many rich features, so it still needs to be matched. Of course, if it is determined that nginx meets the needs, then using nginx will be a more economical way.

2. The load capacity of nginx is much higher than that of apache. The latest server also uses nginx. And after changing the configuration of nginx, you can -t test whether there is any problem with the configuration.

3. When apache is restarted and it is found that the configuration is wrong, it will crash. When making changes, you will be very careful. Now there are many cluster sites, the front-end nginx anti-concurrency, the back-end apache cluster, the cooperation is also good.

4. It is useless for nginx to handle dynamic requests. Generally, apache is required to handle dynamic requests. nginx is only suitable for static and reverse requests.

5. From experience, nginx is a very good front-end server with good load performance. With nginx, it is effortless to use webbench to simulate 10,000 static file requests. Apache has good support for languages ​​​​such as php. In addition, apache has a strong support network. It has been developed longer than nginx and has fewer bugs. However, apache has the disadvantage of not supporting multi-core processing loads. It is recommended to use nginx for the front end and back end. apache. For large websites, it is recommended to use the cluster function of nginx.

6. In most cases, nginx is better than APACHE, such as static file processing, PHP-CGI support, reverse proxy function, front-end Cache, connection maintenance, etc. In Apache PHP (prefork) mode, if PHP processing is slow or the front-end pressure is high, it is easy for the number of Apache processes to surge, resulting in a denial of service.

7. Apache has advantages in processing dynamics. Nginx has better concurrency and low CPU memory usage. If rewrite is frequent, then Apache is the best!

8. Generally speaking, for web services that require performance, use nginx. If you don't need performance and just want stability, then use apache.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of What server is php running on?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn