linux php5.4 mysql安装_linux(apache2.2+php5.4+mysql5.5.30)编译版本

(1)安装mysql5.5.30

编译参数:

cd /tmp/mysql-5.5.30

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/data/dbdata \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DMYSQL_UNIX_ADDR=/usr/local/mysql/tmp/mysql.sock \

-DMYSQL_TCP_PORT=3306 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_EXTRA_CHARSETS=all \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_SSL=yes

make

make install

(2)配置DNS

[root@nan88 ~]# yum list|grep bind

[root@nan88 ~]# yum install bind-libs.x86_64 bind-utils.x86_64 bind-chroot.x86_64 bind.x86_64

[root@nan88 ~]# vim /etc/named.conf

options {

listen-on port 53 { any; };

listen-on-v6 port 53 { ::1; };

directory       "/var/named";

dump-file       "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

memstatistics-file "/var/named/data/named_mem_stats.txt";

allow-query     { any; };

recursion yes;

}

zone "." IN {

type hint;

file "named.ca";

};

zone "cat.com" IN {

type master;

file "named.cat.com";

};

[root@nan88 ~]# vim /var/named/named.cat.com

$TTL    600

@       IN      SOA     cat.com.        root (2014030401 1H 15M 1W 1D);

@       IN      NS      cat.com.

cat.com.        IN      A       10.10.54.88

www.cat.com.    IN      A       10.10.54.88

bbs.cat.com.    IN      A       10.10.54.88

hr.cat.com.     IN      A       10.10.54.88

[root@nan88 ~]# /etc/init.d/named restart

(3)安装apache

安装apache编译版本

[root@nan88 softs]# tar xvf httpd-2.2.21.tar.gz

[root@nan88 softs]# cd httpd-2.2.21

[root@nan88 httpd-2.2.21]# ./configure  --prefix=/usr/local/apache  --enable-modules=most --enable-mods-shared=all --enable-so --with-included-apr

[root@nan88 httpd-2.2.21]# make

[root@nan88 httpd-2.2.21]# make install

//把apache的bin目录加入到PATH变量中去,在文件加入一下面的行,这样就可以直接使用apachectl start/stop/restart

[root@nan88 ~]# vim /etc/profile

export PATH=$PATH:/usr/local/apache/bin

[root@nan88 ~]# source /etc/profile

//或者把/usr/local/apache/bin/apachectl启动文件放到/etc/init.d下

[root@nan88 bin]# /etc/init.d/httpd restart

(4)安装编译版本php

[root@nan88 softs]# tar xvf php-5.4.25.tar.gz

[root@nan88 softs]# cd php-5.4.25

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --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 --with-freetype-dir --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-session --with-gettext --with-mcrypt

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

出现错误:

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决方法:

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz

安装:

tar -zxvf libmcrypt-2.5.7.tar.gz

cd libmcrypt-2.5.7

mkdir -p /usr/local/libmcrytp

./configure prefix=/usr/local/libmcrytp/

make

make install

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

再编译:

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --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 --with-freetype-dir --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-session --with-gettext --with-mcrypt=/usr/local/libmcrypt

--注意修改with-mcrypt=/usr/local/libmcrypt

[root@nan88 php-5.4.25]# make

[root@nan88 php-5.4.25]# make test

[root@nan88 php-5.4.25]# make install

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

出现警告:

** WARNING! Backed up old pear to /usr/local/bin/pear_old

The 'pear' command is now at your service at /usr/local/php/bin/pear

** The 'pear' command is not currently in your PATH, so you need to

** use '/usr/local/php/bin/pear' until you have added

** '/usr/local/php/bin' to your PATH environment variable.

Run it without parameters to see the available actions, try 'pear list'

to see what packages are installed, or 'pear help' for help.

For more information about PEAR, see:

http://pear.php.net/faq.php

http://pear.php.net/manual/

Thanks for using go-pear!

/softs/php-5.4.25/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin

ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar

Installing PDO headers:          /usr/local/php/include/php/ext/pdo/

解决方法:

[root@nan88 softs]# cp go-pear.php php-5.4.25/pear/install-pear

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

(5)编辑apache配置文件,最终整合apache+mysql+php环境

[root@nan88 ~]# vim /usr/local/apache/conf/httpd.conf

LoadModule php5_module        modules/libphp5.so

--看到上面一句表明apache现在已经集成了对php的支持,不过目前,apache还不“认识”.php扩展名的文件,如果通过浏览器请求.php扩展名的文件,那么apache会返回该文件的源代码。解决方法是在Load php Module这一行的下面

LoadModule php5_module lib/modules/libphp5.so

AddType application/x-httpd-php .php --注意如果你的文件的扩展名是.php一定要加这句

AddType application/x-httpd-php .php5 --同上,如果你的文件扩展名是.php5一定要加这句

AddType application/x-httpd-php-source .phps

AddType application/x-httpd-php-source .php5s

DirectoryIndex index.php

DirectoryIndex index.php5

(6)测试

[root@nan88 htdocs]# pwd

/usr/local/apache/htdocs

[root@nan88 htdocs]# vim index.php

phpinfo();

?>

[root@nan88 htdocs]# /etc/init.d/httpd restart

客户端配置:

#vim /etc/resolv.conf

nameserver 10.10.54.88

在客户端浏览器里输入“http://www.cat.com/” --DNS配置的域名

(7)创建论坛

[root@nan88 softs]# mv Discuz_X3.0_SC_UTF8.zip /usr/local/apache/bbs/

[root@nan88 bbs]# yum install unzip.x86_64

[root@nan88 bbs]# unzip Discuz_X3.0_SC_UTF8.zip

[root@nan88 readme]# /etc/init.d/httpd restart

[root@nan88 apache]# chown daemon.daemon bbs -R

测试:

在浏览器中输入:http://bbs.cat.com/upload/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

出现错误:

Forbidden

You don't have permission to access /upload on this server.

解决方法:

[root@nan88 apache]# vim /usr/local/apache/conf/httpd.conf

Options FollowSymLinks

AllowOverride None

Order deny,allow

allow from all

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

再进行测试。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值