apache+php???????????????

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache+php???????????????相关的知识,希望对你有一定的参考价值。

?????????bsp   ??????   grep   mysq   serve   dump   type   ??????   rip   

######## ??????APACHE #############
#??????apr
/usr/src/apache+php/
tar xf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install

#??????apr-util
cd ..
tar xf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make && make install

 

#??????httpd
cd ..
yum install pcre-devel zlib-devel openssl-devel -y
tar xf httpd-2.4.25.tar.gz
cd httpd-2.4.25
./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --enable-so --enable-deflate --enable-expires --enable-headers --enable-ssl --enable-rewrite --enable-mpms-shared=all --with-mpm=prefork --enable-mods-shared=most
make && make install
#?????????./configure --help?????????http://httpd.apache.org/docs/2.4/progms/configure.html????????????????????????


# vim /etc/profile ?????? vim ~/.bash_profile
echo ???export PATH=/usr/local/httpd/bin:$PATH??? >> /etc/profile
. /etc/profile

yum remove httpd* -y

# vi /usr/local/httpd/conf/httpd.conf
sed -i ???s/#ServerName www.example.com:80/ServerName localhost:80/g??? /usr/local/httpd/conf/httpd.conf
apachectl start
netstat -antp | grep httpd

#????????????
ln -s /usr/local/httpd/bin/apachectl /etc/init.d/httpd
echo -e "
# chkconfig: - 85 15 # description: The Apache HTTP Server" >> /etc/init.d/httpd
chkconfig --add httpd
systemctl enable httpd
/etc/init.d/httpd restart


#??????????????????
ls /usr/local/httpd/modules/

#??????????????????
apachectl -t -D DUMP_MODULES

######### ??????PHP ############
#??????php???
yum install libxml2 libxml2-devel -y
tar xf php-5.6.30.tar.gz
cd php-5.6.30
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs
make && make install

vi /usr/local/httpd/conf/httpd.conf
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

/etc/init.d/httpd restart

#?????????
vim /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>

 

#php??????mysql?????????
yum -y install mysql-devel autoconf
ln -s /usr/lib64/mysql /usr/lib/mysql ----64?????????
cd /usr/src/apache+php/php-5.6.30/ext/mysql
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql=/usr
make && make install

???php?????????????????????????????????
cp php???????????????/php.ini-production /usr/local/php/lib/php.ini
vim /usr/local/php/lib/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226"
extension = "mysql.so"
/etc/init.d/httpd restart


#????????????mysql?????????????????????rpm???:
yum install mysql-server -y
mysql
mysql> grant all on *.* to [email protected] identified by ???123???; ##240???php???IP


#??????mysql????????????
cd /usr/local/httpd/htdocs
vim mysql.php
<?php

$conn = mysql_connect(???192.168.18.241???,???root???,???123???);

if (!$conn)
{

die(???Could not connect: ??? . mysql_error());
}

else
{
echo "Connect Successfully!";
}

?>

 


#??????PHP???redis.so???
yum install -y autoconf
cd /tmp/phpredis-3.1.1RC1
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install

#????????????
ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/redis.so

#??????PHP ??????redis?????????
cp php-5.6.30/php.ini-production /usr/local/php/lib/php.ini
vim /usr/local/php/lib/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226"
extension = redis.so


# ???redis?????????bind??????-->??????redis
bind 127.0.0.1 192.168.18.134?????????ip???


#????????????phpinfo.php?????? /usr/local/php/bin/php -m ???????????????????????????redis??????
????????????
<?php
//??????????????? Redis ??????
$redis = new Redis();
$redis->connect(???127.0.0.1???, 6379);

$redis->auth(???123456???);

echo "Connection to server sucessfully.</br>";

//????????????????????????
echo "Server is running: " . $redis->ping();
?>

 

以上是关于apache+php???????????????的主要内容,如果未能解决你的问题,请参考以下文章

apache问题,php高手进来帮帮忙

php apache上传超过100兆视频时候,报错

apache配置文件中怎么配置php

xp下php5连接apache2,急等!!!

删除Mac自带的apache和php

apache配置 php中没有php5apache2_4.dll