重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
安装php扩展软件
创新互联专注于企业成都全网营销推广、网站重做改版、库伦网站定制设计、自适应品牌网站建设、H5场景定制、商城系统网站开发、集团公司官网建设、成都外贸网站制作、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为库伦等各大城市提供网站开发制作服务。#哈稀函数库
[root@localhost ~ ]# tar -zxvf mhash-0.9.9.9.tar.gz
[root@localhost mhash-0.9.9.9]# cd mhash-0.9.9.9
[root@localhost mhash-0.9.9.9]# ./configure
[root@localhost mhash-0.9.9.9]# make
[root@localhost mhash-0.9.9.9]# make install
#处理中文各种编码之间的转换
[root@localhost ~ ]# tar -zxvf libiconv-1.13.tar.gz
[root@localhost libiconv-1.13]# cd libiconv-1.13
[root@localhost libiconv-1.13]# ./configure
[root@localhost libiconv-1.13]# make
[root@localhost libiconv-1.13]# make install
[root@localhost libmcrypt-2.5.8]# tar -zxvf libmcrypt-2.5.8.tar.gz
[root@localhost libmcrypt-2.5.8]# cd libmcrypt-2.5.8
[root@localhost libmcrypt-2.5.8]# ./configure
[root@localhost libmcrypt-2.5.8]# make
[root@localhost libmcrypt-2.5.8]# make install
[root@localhost libmcrypt-2.5.8]# ldconfig -v
[root@localhost libmcrypt-2.5.8]# cd libltdl
[root@localhost libltdl ]# ./configure --with-gmetad --enable-gexec
--enable-ltdl-install
[root@localhost libltdl ]# make && make install
#对库文件做链接
[root@localhost ~ ]# ln -sv /usr/local/lib/libmcrypt* /usr/lib/
[root@localhost ~ ]# ln -sv /usr/local/lib/libmhash.* /usr/lib/
#跟新链接库
[root@localhost ~ ] # ldconfig -v
安装php
14
root@localhost ~]# tar -zxvf php-5.4.9.tar.gz
[root@localhost ~]# cd php-5.4.9
[root@localhost php-5.4.9]# ./configure \
--prefix=/usr/local/php5nginx \
--with-config-file-path=/usr/local/php5nginx/etc \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-iconv-dir=/usr/local \
--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 --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-ldap --with-ldap-sasl \
--with-xmlrpc --enable-zip --enable-soap \
[root@localhost php-5.4.9]# make ZEND_EXTRA_LIBS='-liconv'
[root@localhost php-5.4.9]# make install
[root@localhost php-5.4.9]# cp php.ini-production \
>/usr/local/php5nginx/etc/php.ini
配置fast-cgi
[root@localhost ~]# cd /usr/local/php5nginx/etc/
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# vim php-fpm.conf
# 对相应内容进行修改
[global]
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = error
daemonize = yes
[www]
user = www
group = www
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 32
pm.start_servers = 15
pm.min_spare_servers = 5
pm.max_spare_servers = 32
启动php-fpm
[root@localhost ~]# cd php-5.4.9/sapi/fpm/
[root@localhost fpm]# cp init.d.php-fpm /etc/rc.d/init.d/php-fpm
[root@localhost fpm]# chmod +x /etc/rc.d/init.d/php-fpm
[root@localhost fpm]# chkconfig --add php-fpm
[root@localhost fpm]# service php-fpm start|restart|reload|restart
[root@localhost fpm]# ps aux | grep php-fpm
编辑nginx.conf文件
[root@localhost ~ ]# vim /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.php index.html index.htm; //添加index.php选项
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; // Fast-cgi参数文件
include fastcgi_params;
}
编辑fastcgi_params文件
[root@localhost ~ ]# vim /usr/local/nginx/conf/fastcgi_params
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
……
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
……
fastcgi_param DOCUMENT_ROOT $document_root;
测试
[root@localhost ~]# pkill -9 nginx
[root@localhost ~]# /usr/local/nginx/sbin/nginx
[root@localhost ~]# /etc/rc.d/init.d/php-fpm restart
[root@localhost html]# vim index.php
phpinfo();
?>
[root@localhost html]#
测试数据库链接
$links=mysql_connect("localhost","root","");
if($links){
echo "link db ok!!!";
}
else{
echo "link db no!!!";
}
?>
[root@localhost html]#
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。