笔记:centos6 php配置测试
admin
2023-06-22 12:02:27
0次

先安装

nginx

mysql


安装大部分通用的依赖包(不影响安装,但是容易造成使用环境出现问题)

freetype-devel libpng-devel gd-devel curl-devel(libcurl-devel) libxslt-devel

zlib-devel libxml2-devel libjpeg-devel(libjpeg-turbo-devel) libiconv-devel 


其中有可能libiconv-devel (若第三方源有用yum可以安装则不需要这步)

mkdir -p ~/tools && cd ~/tools &&\

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz &&\

tar xf libiconv-1.14.tar.gz && cd libiconv-1.14 &&\

./configure --prefix=/usr/local/libiconv && make && make install && echo $?


检查下是否已经安装

rpm -qa xxx


安装libmcrypt库(编译安装)

wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

tar xf libmcrypt-2.5.8.tar.gz && cd libmcrypt && ./configure && make && make install

sleep 5

/sbin/ldconfig && cd libltdl/ && ./configure --enable-ltdl-install && make && make install


可以使用yum安装以上的包,部分需要第三方源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo &&\

yum install libmcrypt-devel -y


安装mcrypt

yum install mcrypt -y && rpm -qa grep|mcrypt


安装mhash库

yum install mhash mhash-devel -y


###############################

PHP5.3

解压进入目录

查看编译参数

./configure --help


当使用--with-mysql=mysqlnd 时,本地不需要安装mysql

mysql,curl,fpm,with-fpm-user,with-fpm-group为关键参数

./configure \

--prefix=/application/php5.x.x \

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-iconv-dir=/usr/local/libiconv \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir=/usr \

--enable-xml \

--disable-rpath \

--enable-safe-mode \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--with-curlwrappers \

--enable-mbregex \

--enable-fpm \

--enable-mbstring \

--with-mcrypt \

--with-gd \

--enable-gd-native-ttf \

--with-openssl \

--with-mhash \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-zip \

--enable-soap \

--enable-short-tags \

--enable-zend-multibyte \

--enable-static \

--with-xsl \

--with-fpm-user=nginx \

--with-fpm-group=nginx \

--enable-ftp



(待确认功能)--enable-mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-mysqli=mysqlnd \


假如使用自己的数据库则make前需要处理下(2选1)

1、ln /application/mysql/lib/libmysqlclient.so.18 /usr/lib64 && touch ext/phar/phar.phar

2、echo '/application/mysql/lib' >>/etc/ld.so.conf && ldconfig


make && make install && ln -s /application/php5.3.xx /application/php


############################

PHP5.5部分参数不可用


./configure \

--prefix=/application/php5.x.x \

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-iconv-dir=/usr/local/libiconv \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir=/usr \

--enable-xml \

--disable-rpath \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--enable-mbregex \

--enable-fpm \

--enable-mbstring \

--with-mcrypt \

--with-gd \

--enable-gd-native-ttf \

--with-openssl \

--with-mhash \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-soap \

--enable-short-tags \

--enable-static \

--with-xsl \

--with-fpm-user=nginx \

--with-fpm-group=nginx \

--enable-ftp


##############################

配置解析文件(若需要优化php解析,改该文件)

cp /application/php/php.ini-production /application/php/lib/php.ini


配置进程文件

cp /application/php/etc/php-fpm.conf.default /application/php/etc/php-fpm.conf


修改fpm配置文件

pid = /app/logs/php-fpm.pid

error_log = /app/logs/php-fpm.log

log_level = error

;文件描述符

rlimit = 32768

events.mechanism = epoll

listen.owner = nginx

listen.group = nginx

pm.max_children = 1024

pm.start_servers = 16

pm.min_spare_servers = 5 

pm.max_spare_servers = 20

pm.process_idle_timeout = 15s;

pm.max_requests = 2048

slowlog = /app/logs/$pool.log.slow

request_slowlog_timeout = 10

p_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f xxx@xxx.com


配置nginx,将请求处理追加到server配置里

location ~.*/.(php|php5)?$ {

 root html/blog;

 fastcgi_pass 127.0.0.1:9000;

 fastcgi_index index.php;

 include fastcgi.conf;

}


重新检查加载nginx文件


页面测试

phpinfo();

?>


数据库测试

$link_id=mysql_connect('mysql_server','mysql','password') or mysql_error();

if($link_id){

echo "successful!";

}else{

echo mysql_error();

}

?>




相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...