在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
配置php连接apache 1、安装php所需要的库yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel openssl openssl-devel -y yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y #安装yum无法安装的libiconv库 #进入到安装软件的存放目录 wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make make install cd ../ #安装第三方源 wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum -y install libmcrypt-devel yum -y install mhash yum -y install mcrypt
2、安装php#这里以php 5.3.27为例子 #首先下载php的安装包,解压后 #进入到apache的安装目录 ./configure \ --prefix=/application/php5.3.27 \ --with-apxs2=/application/apache/bin/apxs \ --with-mysql=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-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 \ --enable-ftp
make make install ln -s /application/php5.5.32/ /application/php #做软链接
3、配置httpd.conf连接php#nginx是通过 location匹配去抛给fastcgi,而Apache是通过模块的模式 #311行下增加: AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps #168行下增加: DirectoryIndex index.php index.html #67行下增加 User www Group www #还要把默认的用户属组注释掉 #建立用户: useradd -u 893 -s /sbin/nologin -M www id www
/application/apache/bin/apachectl -t /application/apache/bin/apachectl graceful
4、检测
检查PHP: <?php phpinfo(); ?>
检查MySQL: <?php $link_id=mysql_connect('db01.etiantian.org','wordpress','123456') or mysql_error(); if($link_id){ echo "mysql successful by oldboy training!"; } else{ echo mysql_error(); } ?>
|
2022-07-18
2022-08-17
2022-11-06
2022-07-29
2022-08-18
请发表评论