随笔 - 137  文章 - 1  评论 - 3  阅读 - 14万 

     1.安装PHP所需要的扩展

         

1
2
yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel 
gd gd-devel 

  

 

     2. 编译PHP代码

1
2
3
4
./configure --prefix=/usr/local/php7 --disable-debug --enable-shared --enable-fpm --with-fpm-user=www --with-fpm-group=www  --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
 --with-libxml-dir --with-openssl --with-bz2 --with-mcrypt  --enable-gd-native-ttf --with-curl --with-zlib-dir -with-gettext --with-jpeg-dir --with-png-dir
--with-bz2 --with-freetype-dir --with-iconv --with-config-file-path=/usr/local/php7/etc --enable-mbstring --with-gd --disable-debug 
--enable-short-tags --disable-posix --enable-exif --enable-ftp --enable-sockets --with-mhash --enable-zip  --enable-opcache --enable-inline-optimizationmake make install cp php.ini-production /usr/local/php7/etc/php.ini

  

 

     3.配置php文件

      

1
2
3
4
5
6
7
8
9
10
编辑 php.ini文件  设置如下
 
short_open_tag = On
 
disable_functions = "dl,exec,passthru,pcntl_exec,popen,posix_kill,posix_mkfifo,posix_setuid,proc_close,proc_open,
proc_terminate,shell_exec,system,leak,posix_setpgid,posix_setsid,proc_get_status,proc_nice,show_source"
 
cgi.fix_pathinfo=0
 
date.timezone = Asia/Shanghai<br><br>expose_php = Off

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cp php-fpm.conf.default  php-fpm.conf
  
  编辑  php-fpm.conf  设置如下
 
  pid = /usr/local/php7/var/run/php-fpm.pid
   
  error_log = log/php-fpm.log
 
  log_level = notice
   
   process_control_timeout = 30
 
  events.mechanism = epoll
 
  listen = 127.0.0.1:9007
   
   listen.backlog = -1
   
   pm.max_children = 1024
 
    pm.start_servers = 80
    
    pm.min_spare_servers = 20
 
    pm.max_spare_servers = 80
 
    pm.max_requests = 2000
 
    pm.status_path = /status
 
    ping.path = /ping
    
    ping.response = pong
 
    slowlog =  var/log/phpslow_$pool.log
 
    request_slowlog_timeout = 5s
    
    request_terminate_timeout = 60s
 
     rlimit_files = 65534
 
    php_admin_value[open_basedir] = "/tmp/"
php_admin_value[disable_functions] = dl,exec,leak,passthru,pcntl_exec,popen,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system

  

 


    3.启动与测试PHP

     

1
2
3
4
5
6
7
8
9
10
11
12
13
#测试php-fpm配置
/usr/local/php7/sbin/php-fpm -t
/usr/local/php7/sbin/php-fpm -c /usr/local/php7/etc/php.ini -y /usr/local/php7/etc/php-fpm.conf -t
 
#启动php-fpm
/usr/local/php7/sbin/php-fpm
/usr/local/php7/sbin/php-fpm -c /usr/local/php7/etc/php.ini -y /usr/local/php7/etc/php-fpm.conf
 
#关闭php-fpm
kill -INT `cat /usr/local/php7/var/run/php-fpm.pid`
 
#重启php-fpm
kill -USR2 `cat /usr/local/php7/var/run/php-fpm.pid`

  






posted on   ヽ坚强的蘑菇  阅读(415)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
点击右上角即可分享
微信分享提示