• 欢迎访问运维搬运工网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 本站一年会员:100元 ,两年会员:180元 ,永久会员:380元
  • 这世界就是,一些人总在昼夜不停地运转,而另外一些人,起床就发现世界已经变了。
  • 本博客推广的是知识付费,用赞助的方式实现博客维护,不以赚钱为目的的博客

PHP安装

PHP 大自然搬运工 2年前 (2017-12-21) 1187次浏览 已收录 2个评论 扫描二维码

安装PHP

[root@host-192-168-0-2 mysql]# cd /usr/local/src/
[root@host-192-168-0-2 src]# wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

解压

[root@host-192-168-0-2 src]# tar zxf php-5.6.30.tar.gz

创建用户

[root@host-192-168-0-2 src]# useradd -s /sbin/nologin php-fpm

开始编译

[root@host-192-168-0-2 php-5.6.30]# yum install -y libxslt-devel net-snmp-devel pspell-devel unixODBC-devel mysql-devel pcre-devel libxml2-devel libxslt-devel net-snmp-devel aspell-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel ibpng-devel freetype-devel libmcrypt php-mcrypt libmcrypt libmcrypt-devel
[root@host-192-168-0-2 php-5.6.30]# pwd
/usr/local/src/php-5.6.30
[root@host-192-168-0-2 php-5.6.30]# ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl

检查有木有错误

[root@host-192-168-0-2 php-5.6.30]# echo $?
0

安装

[root@host-192-168-0-2 php-5.6.30]# make && make install

拷贝配置文件

[root@host-192-168-0-2 php-5.6.30]# cp php.ini-production /usr/local/php-fpm/etc/php.ini

修改配置文件

[root@host-192-168-0-2 etc]# pwd
/usr/local/php-fpm/etc
[root@host-192-168-0-2 etc]# vim php-fpm.conf

[global]
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
listen.mode = 666
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024

拷贝启动脚本

[root@host-192-168-0-2 php-5.6.30]# pwd
/usr/local/src/php-5.6.30

[root@host-192-168-0-2 php-5.6.30]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

开机启动

[root@host-192-168-0-2 php-5.6.30]# chmod 755 /etc/init.d/php-fpm
[root@host-192-168-0-2 php-5.6.30]# chkconfig --add php-fpm
[root@host-192-168-0-2 php-5.6.30]# chkconfig php-fpm on
[root@host-192-168-0-2 php-5.6.30]# service php-fpm start
Starting php-fpm done
[root@host-192-168-0-2 php-5.6.30]# ps aux |grep php-fpm
root 18525 0.0 0.1 123548 4936 ? Ss 23:00 0:00 php-fpm: master process (/usr/local/php-fpm/etc/php-fpm.conf)
php-fpm 18526 0.0 0.1 125632 5060 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18527 0.0 0.1 125632 5060 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18528 0.0 0.1 125632 5060 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18529 0.0 0.1 125632 5060 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18530 0.0 0.1 125632 5064 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18531 0.0 0.1 125632 5064 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18532 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18533 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18534 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18535 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18536 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18537 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18538 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18539 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18540 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18541 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18542 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18543 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18544 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
php-fpm 18545 0.0 0.1 125632 5068 ? S 23:00 0:00 php-fpm: pool www
root 18548 0.0 0.0 112660 968 pts/0 S+ 23:00 0:00 grep --color=auto php-fpm

运维搬运工 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:PHP安装
喜欢 (0)
[扫描二维码]
分享 (0)
大自然搬运工
关于作者:
不是路不平,而是你不行。到底行不行,看你停不停。只要你不停,早晚都能行。
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(2)个小伙伴在吐槽
  1. I am really enjoying the theme/design of your website. Do you ever run into any browser compatibility issues? A number of my blog readers have complained about my site not operating correctly in Explorer but looks great in Opera. Do you have any solutions to help fix this problem?
    viagra tablets australia2019-03-27 10:07 回复 Windows 7 | Chrome 68.0.3440.106
    • 大自然搬运工
      It is recommended that you use the Google chrome browser
      大自然搬运工2019-04-03 14:25 回复 Mac OS X | Safari浏览器 605.1.15