当前位置:网站首页>Analysis of PHP environment configuration
Analysis of PHP environment configuration
2022-06-24 05:06:00 【User 7426861】
PHP As an open source server-side scripting language , stay web It's widely used . If you want to download some open source applications ,github On php Open source software choices are often better than Java even more than . lately , Studied linux Next php Installation , The main experience is as follows .
PHP-INI
php.ini File is php And can only be named as php.ini, It's right php Application global settings file , There are a lot of options , contain php Page usage memory size limit , Upload and download file size limit , Floating point precision, etc .
FPM-PHP
fpm-php(FastCGI ProcessManager) It was originally php Third party package for , stay php5.3.3 It became php Core members of , No need to download and install separately .FastCGI Before the birth of ,web The end forwards a php After the request , Need to reload php.ini, adopt fpm-php establish master process , Received more than one php request , Create child processes to share master Process loaded php.ini Information . install fpm-php after , start-up php In fact, by starting fpm-php.service To achieve .fpm-php and web Communication can be achieved in two ways ,socket and tcp The way , adopt /etc/php-fpm.d/www.conf To configure . The main difference between the two methods is listen The configuration of is different . One is php-fpm.sock, One is the server ip:9000.
socket The way is long connection , Apply to php On the same server as other services
[www] user = nginx group = nginx listen = /run/php-fpm.sock
tcp The way is http Request mode , It is suitable for multi server cluster with high concurrency
[www] user = nginx group = nginx listen = 127.0.0.1:9000
Let's talk about how processes are allocated , In terms of the following configuration ,start_servers=10 explain php The service starts 10 individual worker The child process has been waiting ,min_spare_servers=5 Is the smallest active process .php On at start up 8 A process , If not received web request ,fpm-php It will release some , Finally achieve 5 A process . But not more than max_spare_servers = 35. as for max_children=50, That's static configuration , constant , It's a waste of resources , Always on 50 Processes are waiting there , It's the same even if no one visits the site .
pm.max_children = 50 pm.start_servers = 10 pm.min_spare_servers = 5 pm.max_spare_servers = 35
Expansion pack,
Install only php Often can not meet the needs of the application software , There are a lot of other extension packages to support php application . for example ,【odbc,common,ima,mongodb,xml etc. 】, However, it should be noted that the following packages are based on pecl Of 【apcu,imagick,goeip,mcrypt,redis,zip,memcache】. especially ,zip Packages need to be specified in particular pecl, Otherwise, the expansion pack installation will not succeed , other pecl Bags can be made from remi Automatically find the response package in the source .
yum install php-common yum install php-apcu yum install php-pecl-zip
web Server related configuration
php and web The server nginx,apache We also need to do some association configuration , Add the following to their profile :
nginx:
location ~ .*\.php$
{
fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
try_files $uri = 404;
}
apache:
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm.sock|fcgi://localhost"
</FilesMatch>however ,ubuntu Under the system PHP Application and use apache In the case of servers , Need configuration , Otherwise, vice versa apache The server reported an error and could not be started . That's right php To understand the configuration of , In the future, with the deepening of its research , And write about php Something new .
边栏推荐
- NAT
- How to change the IP address of ECS? What are the precautions for changing the IP address
- Introduction to vulnerability priority technology (VPT)
- 『应急响应实践』LogParser日志分析实践
- SAP mts/ato/mto/eto topic 8: ATO mode 2 d+ empty mode strategy 85
- How RedHat 8 checks whether the port is connected
- Shopify background XSS storage vulnerability
- Ext4 file system jam caused by MEM CGroup OOM
- Weak current engineer, 25g Ethernet and 40g Ethernet: which do you choose?
- LeetCode 1791. Find the central node of the star chart
猜你喜欢

Leetcode (question 1) - sum of two numbers
![[leetcode daily question] push domino](/img/81/1c31e97d9a245816514bcf47c92107.jpg)
[leetcode daily question] push domino

Popularization of children's programming education in specific scenarios

What are the disadvantages of the free IP address replacement tool?

What is the new generation cloud computing architecture cipu of Alibaba cloud?

Facebook internal announcement: instant messaging will be re integrated

SAP mts/ato/mto/eto topic 10: ETO mode q+ empty mode unvalued inventory policy customization

Analyzing the superiority of humanoid robot in the post human era

Training methods after the reform of children's programming course

Idea creates a servlet and accesses the 404 message
随机推荐
Understanding OAuth 2.0
What is a network domain name? What is the role of a domain name for an enterprise
Shopify background XSS storage vulnerability
LeetCode 1662. Check whether two string arrays are equal
What server does domain name and IP address convert through? How does the server convert?
Recognize workplus again, not only im but also enterprise mobile application management expert
MySQL cases MySQL find out who holds the row lock (RC)
Bi-sql - Select
Customer disaster recovery case - a MySQL database migration scheme
Where is the cheaper domain name? What should I pay attention to when buying a domain name?
IP and traffic reconciliation tool networktrafficview
When remote, your resolution is lower than a × B. Some items may not be displayed on the screen
Let children learn the application essence of steam Education
Eigen eigenMatrix
Hard core observation 553 AI needs to identify almost everyone in the world with hundreds of billions of photos
少儿编程教育在特定场景中的普及作用
Deep learning NLP from RNN LSTM Gru seq2seq to attention classification and analysis
What is the role of ECS? How does FTP connect to ECS configuration?
What is the difference between a traditional data center and a cloud computing data center?
How does the mobile phone remotely connect to the ECS? What should be paid attention to during the operation