一、安装PHP
1、下载php
wget http://cn2.php.net/distributions/php-7.0.4.tar.gz
http://cn.php.net/distributions/php-7.2.3.tar.gz
2、解压
tar -xzf php-7.0.4.tar.gz
3、安装必备工具:
yum install -y libxml2 libxml2-devel curl-devel libxslt-devel libxslt make automake gcc gcc-c++ pcre-devel zlib-devel sqlite-devel openssl-devel libvpx libjpeg libpng zlib libXpm libXpm-devel FreeType freetype-devel t1lib libt1-devel libicu-devel libjpeg-devel libpng-devel
4、config记得包含: pdo_mysql 等扩展
./configure --prefix=/usr/local/php7 \
--with-curl \
--with-freetype-dir \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-jpeg-dir=/usr/local/jpeg \
--with-gd \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--with-libmemcached-dir=/usr/local/libmemcached \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip
make && make install
5、配置文件
#######方法一:直接使用编译后未经优化处理的配置
cp php.ini-production /usr/local/php/etc/php.ini
cp /root/php-src-master/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
#######方法二:使用https://typecodes.com/web/php7configure.html文中的配置
mv ~/php.ini /usr/local/php7/etc/php.ini && mv ~/php-fpm /etc/init.d/php-fpm
mv ~/php-fpm.conf /usr/local/php7/etc/php-fpm.conf && mv ~/www.conf /usr/local/php7/etc/php-fpm.d/www.conf
6、配置GD库添加 jpeg 文件的支持
一般源码安装添加的GD库 是不支持 jpeg 格式的图片的,只支持如下格式
GD Support enabled
GD Version bundled (2.0.34 compatible)
GIF Read Support enabled
GIF Create Support enabled
PNG Support enabled
libPNG Version 1.2.49
WBMP Support enabled
XBM Support enabled
下面我们来 添加 jpeg 格式文件的支持
wget http://www.ijg.org/files/jpegsrc.v8b.tar.gz
tar -zxvf jpegsrc.v8b.tar.gz
cd jpeg-8b
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make && make install
下面进入到 php 源码目录下 的 ext 下的 gd目录
进入gd 目录后执行 注意下面的 /usr/local/php/ 是你服务器 php的安装路径。我的是 这个路径就写成这样了
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-jpeg-dir=/usr/local/jpeg/
make && make install
执行完这些 系统就会提示你 gd.so 生成目录
在php.ini下 添加 gd.so 后 重启php 重启 应用服务器后就OK了
有些机器可能还不行,这样解决
yum install libjpeg-devel freetype-devel libpng-devel
make clean后重新./configure
make&make install
查看phpinfo OK了
7、kangle集成php704
《扩展》-->《命令》
/usr/local/php/bin/php-cgi
PHPRC="/usr/local/php/lib/php.ini" PHP_FCGI_MAX_REQUESTS="0"
fastCGI
二、memcache和redis
1、memcache和redis还没有出php7的扩展,要从github获取
参考:https://www.skyoy.com/php7-memcached-wordpress.html
https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
http://www.ppefx.com/pecl-memcache-php7.tar.gz
wget http://www.ppefx.com/pecl-memcache-php7.tar.gz
tar -xzf pecl-memcache-php7.tar.gz
cd pecl-memcache-php7
export PHP_PREFIX="/usr/local"
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
修改php.ini文件,加载Memcache组件。
[memcache]
extension_dir = "/usr/local/php70/lib/php/extensions/no-debug-non-zts-20151012/"
extension = "memcache.so"
2、配置Memcached的步骤,首先安装Libevent事件触发管理器。
必装,无法用yum更新
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar vxf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure -prefix=/usr/local/libevent # ./configure
make && make install
3、编译Memcached
http://memcached.org/
wget http://memcached.org/files/memcached-1.4.25.tar.gz
tar vxf memcached-1.4.25.tar.gz
cd memcached-1.4.25
./configure -with-libevent=/usr/local/libevent
make && make install
4、启动Memcached
/usr/local/bin/memcached -d -m 128 -l 127.0.0.1 -p 11211 -u root # (128为内存, 11211为端口,root为用户组)
三、vsftpd:
1、安装
yum install vsftpd
2. 启动/停止/重启
# service vsftpd start
# service vsftpd stop
# service vsftpd restart
3. 主配置文件
# vi /etc/vsftpd.conf
这里主要是设置如何让root用户可以登录的。
因为默认配置是不行。
主要在vsftpd.conf的两个参数控制
userlist_enable和pam_service_name
默认userlist_enable是YES的状态,pam_service_name是vsftpd
你需要在/etc/vsftpd/user_list文件中把root那一行删除或者注释掉
同理,/etc/vsftpd/ftpusers文件中的root也注释掉