环境信息介绍:
在利通等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、成都网站制作 网站设计制作按需策划,公司网站建设,企业网站建设,品牌网站制作,全网营销推广,成都外贸网站制作,利通网站建设费用合理。
系统信息:CentOS release 6.6 (Final)2.6.32-504.el6.x86_64 x86_64 (获取方法 : cat/etc/redhat-release ;uname -r ;uname -m)
IP地址 :172.16.6.61/16
apache版本Apache/2.4.10
数据库版本:mariadb-5.5.43-linux-x86_64.tar.gz
xcache版本:xcache-3.2.0.tar.bz2
PHP版本:php-5.4.40.tar.bz2
安装开发工具
yum groupinstall "Development tools" "Server Platform Development"
#安装apr
tar xvf apr-1.5.0.tar.bz2
cd apr-1.5.0
./configure--prefix=/usr/local/apr
make && make install
cd ..
安装apr-util
tar xvfapr-util-1.5.3.tar.bz2
cd apr-util-1.5.3
./configure--prefix=/usr/local/apr-util --with-apr=/usr/local/apr
cd ../
make && make install
安装httpd-2.4.10
#解决pcre的依赖关系
yum install pcre-devel -y
tar xvf httpd-2.4.10.tar.bz2
cd httpd-2.4.10
./configure--prefix=/usr/local/httpd24 --enable-so --enable-ssl --enable-cgi--enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --enable-modules=most--enable-mpms-shared=all --with-mpm=event
make && make install
cd ../
#添加运行MySQL的用户和用户组
groupadd -g 306 mysql
useradd -r -u 306 -g 306 -s/sbin/nologin mysql
id mysql
#uid=306(mysql)gid=306(mysql) groups=306(mysql)
安装mariadb
tar xvfmariadb-5.5.43-linux-x86_64.tar.gz -C /usr/local/
cd /usr/local/
#创建符号链接
ln -smariadb-5.5.43-linux-x86_64 mysql
ls -lh mysql
#lrwxrwxrwx 1 root root 27May 3 19:54 mysql ->mariadb-5.5.43-linux-x86_64
cd mysql/
cp support-files/mysql.server/etc/init.d/mysqld
chmod u+X /etc/init.d/mysqld
#创建数据目录
mkdir /data/mydata -p
#授权mysql 为mysql数据目录的的属主
chown -R root.mysql/usr/local/mariadb-5.5.43-linux-x86_64/
chown mysql.root /data/mydata
#初始化mysql
/usr/local/mysql/scripts/mysql_install_db--user=mysql --datadir=/data/mydata/
修改my.cnf 添加数据目录的位置
[root@localhost mysql]# vim/etc/my.cnf
[mysqld]
datadir = /data/mydata
###
sed -i '/\[mysqld]\/ adatadir = /data/mydata' /etc/my.cnf
启动mysql
/etc/init.d/mysqld start
确认当前httpd的MPM模式
#启动httpd
/usr/local/httpd24/bin/apachectlstart
#查看当前http的加载的模块
/usr/local/httpd24/bin/apachectl-M| grep mpm_
修改为http的MPM的方法
[root@localhost ~]# vim/usr/local/httpd24/conf/httpd.conf
#LoadModule mpm_event_modulemodules/mod_mpm_event.so
LoadModule mpm_prefork_modulemodules/mod_mpm_prefork.so
重启httpd
[root@localhost ~]#/usr/local/httpd24/bin/apachectl stop
[root@localhost ~]#/usr/local/httpd24/bin/apachectl start
解决PHP rpm包的依赖关系
yum install bzip2-devel -y
yum install -ylibmcrypt-devel
./configure --prefix=/usr/local/php--with-mysql=/usr/local/mysql --with-openssl--with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib--with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
make && make install
#cpphp的配置文件
#php配置文件 (在php源码目录下)
[root@localhost php-5.4.40]#ll php.ini-*
-rw-r--r-- 1 502 games 65429Apr 15 12:16 php.ini-development #开发环境中使用
-rw-r--r-- 1 502 games 65459Apr 15 12:16 php.ini-production #生产环境中使用
#复制php.ini-production到/etc/php/php.ini
mkdir /etc/php
cp php.ini-production/etc/php/php.ini
vim /usr/local/httpd24/conf/httpd.conf
1、添加如下二行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
2、定位至DirectoryIndex index.html
修改为:
DirectoryIndex index.php index.html
#配置后的结果
grep php /usr/local/httpd24/conf/httpd.conf-n
152:LoadModule php5_module modules/libphp5.so
253: DirectoryIndex index.php index.html
382: AddType application/x-httpd-php .php
383: AddType application/x-httpd-php-source .phps
重启httpd
[root@localhost htdocs]#/usr/local/httpd24/bin/apachectl stop
[root@localhost htdocs]#/usr/local/httpd24/bin/apachectl start
建立php链接mysql的测试页
cat >/usr/local/httpd24/htdocs/test_mysql.php < $link =mysql_connect('127.0.0.1','root',''); if ($link) echo "Success..."; else echo "Failure..."; mysql_close(); ?> < tar xvf xcache-3.2.0.tar.bz2 cd xcache-3.2.0 /usr/local/php/bin/phpize ./configure --enable-xcache-with-php-config=/usr/local/php/bin/php-config make && make install #在编译安装最后 ### #Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/ ### mkdir /etc/php.d cp xcache.ini /etc/php.d/ #在xcache源代码书目录下 修改xcache.ini [root@localhostxcache-3.2.0]# vim /etc/php.d/xcache.ini 修改extension = xcache.so 为 extension =/usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so 重启httpd [root@localhost xcache-3.2.0]#/usr/local/httpd24/bin/apachectl stop [root@localhostxcache-3.2.0]# /usr/local/httpd24/bin/apachectl start 建立php测试页 cat >/usr/local/httpd24/htdocs/index.php < phpinfo(); ?> <安装xcache
浏览器访问
新闻标题:LAMP_PHP模块方式
当前路径:http://bzwzjz.com/article/ijhgdi.html