您的位置:首页 > 运维架构 > Apache

mysql php apache 整合

2012-02-29 11:50 411 查看
[root@localhost ~]# wget http://archive.apache.org/dist/httpd/httpd-2.4.1.tar.gz

[root@localhost ~]# wget http://files.directadmin.com/services/all/mysql/mysql-5.5.20.tar.gz

[root@localhost ~]# wget http://mirror.yongbok.net/nongnu/freetype/freetype-2.4.8.tar.gz



[root@localhost ~]# wget http://www.ijg.org/files/jpegsrc.v8.tar.gz


[root@localhost ~]# wget http://cdnetworks-kr-2.dl.sourceforge.net/project/libpng/libpng12/1.2.47/libpng-1.2.47.tar.gz

下载gd-2.0.35

[root@localhost httpd-2.4.1]# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-mpm=worker

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu


Configuring Apache Portable Runtime library ...

checking for APR... no

configure: error: APR not found. Please read the documentation.


[root@localhost ~]# rpm -qa | grep apr

[root@localhost ~]# yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs

[root@localhost ~]# tar zxvf apr-1.4.5.tar.gz

[root@localhost ~]# cd apr-1.4.5

[root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr


[root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

Configuring APR library

Platform: i686-pc-linux-gnu

checking for working mkdir -p... yes

APR Version: 1.4.5

checking for chosen layout... apr

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/root/apr-1.4.5':

configure: error: no acceptable C compiler found in $PATH

See `config.log' for more details.


[root@localhost httpd-2.4.1]#yum -y install gcc

[root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr

[root@localhost apr-1.4.5]#make & make install

[root@localhost httpd-2.4.1]# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-mpm=worker

checking for chosen layout... Apache

checking for working mkdir -p... yes

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu


Configuring Apache Portable Runtime library ...

checking for APR... yes

setting CC to "gcc"

setting CPP to "gcc -E"

setting CFLAGS to " -g -O2 -pthread"

setting CPPFLAGS to " -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"

setting LDFLAGS to " "


Configuring Apache Portable Runtime Utility library...

checking for APR-util... no

configure: error: APR-util not found. Please read the documentation.


[root@localhost ~]# tar zxvf apr-util-1.3.12.tar.gz

[root@localhost ~]# cd apr-util-1.3.12

[root@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config &make &make install


[root@localhost httpd-2.4.1]# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-mpm=worker --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/

checking for pcre-config... false

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/


[root@localhost ~]# cd pcre-8.10

[root@localhost pcre-8.10]# ./configure --prefix=/usr/local/pcre & make


-c -o pcrecpp.lo pcrecpp.cc

libtool: compile: g++ -DHAVE_CONFIG_H -I. -c pcrecpp.cc -o .libs/pcrecpp.o

./libtool: line 990: g++: command not found

make[1]: *** [pcrecpp.lo] Error 1

make[1]: Leaving directory `/root/pcre-8.10'

make: *** [all] Error 2


[root@localhost pcre-8.10]# yum -y install gcc-c++


【Mysql常用编译参数】

help 获取帮助

prefix 指定安装目录

without-server 只安装客户端

with-charset 默认字符集

with-extra-charsets 可选的扩展字符集

with-ndbcluster 支持mysql集群

with-big-tables 单表支持40亿条记录

with-openssl 支持openssl




/configure //配置源代码树

--prefix=/usr/local/apache2 //体系无关文件的顶级安装目录PREFIX ,也就Apache的安装目录。

--enable-module=so //打开 so 模块,so 模块是用来提 DSO 支持的 apache 核心模块

--enable-deflate=shared //支持网页压缩

--enable-expires=shared //支持 HTTP 控制

--enable-rewrite=shared //支持 URL 重写

--enable-cache //支持缓存

--enable-file-cache //支持文件缓存

--enable-mem-cache //支持记忆缓存

--enable-disk-cache //支持磁盘缓存

--enable-static-support //支持静态连接(默认为动态连接)

--enable-static-htpasswd //使用静态连接编译 htpasswd – 管理用于基本认证的用户文件

--enable-static-htdigest //使用静态连接编译 htdigest – 管理用于摘要认证的用户文件

--enable-static-rotatelogs //使用静态连接编译 rotatelogs – 滚动 Apache 日志的管道日志程序

--enable-static-logresolve //使用静态连接编译 logresolve – 解析 Apache 日志中的IP地址为主机名

--enable-static-htdbm //使用静态连接编译 htdbm – 操作 DBM 密码数据库

--enable-static-ab //使用静态连接编译 ab – Apache HTTP 服务器性能测试工具

--enable-static-checkgid //使用静态连接编译 checkgid

--disable-cgid //禁止用一个外部 CGI 守护进程执行CGI脚本

--disable-cgi //禁止编译 CGI 版本的 PHP

--disable-userdir //禁止用户从自己的主目录中提供页面

--with-mpm=worker // 让apache以worker方式运行

--enable-authn-dbm=shared // 对动态数据库进行操作。Rewrite时需要。
[b]用于apr的configure脚本的选项:

可选特性:


--enable-experimental-libtool //启用试验性质的自定义libtool

--disable-libtool-lock //取消锁定(可能导致并行编译崩溃)

--enable-debug //启用调试编译,仅供开发人员使用。

--enable-maintainer-mode //打开调试和编译时警告,仅供开发人员使用。

--enable-profile //打开编译profiling(GCC)

--enable-pool-debug[=yes|no|verbose|verbose-alloc|lifetime|owner|all] //打开pools调试

--enable-malloc-debug //打开BeOS平台上的malloc_debug

--disable-lfs //在32-bit平台上禁用大文件支持(large file support)

--enable-nonportable-atomics //若只打算在486以上的CPU上运行Apache ,那么使用该选项可以启用更加高效的基于互斥执行的原子操作。

--enable-threads //启用线程支持,在线程型的MPM上必须打开它

--disable-threads //禁用线程支持,如果不使用线程化的MPM ,可以关闭它以减少系统开销。

--disable-dso //禁用DSO支持

--enable-other-child //启用可靠子进程支持

--disable-ipv6 //禁用IPv6支持
可选的额外程序包:


--with-gnu-ld //指定C编译器使用 GNU ld

--with-pic //只使用 PIC/non-PIC 对象[默认为两者都使用]

--with-tags[=TAGS] //包含额外的配置

--with-installbuilddir=DIR //指定APR编译文件的存放位置(默认值为:’${datadir}/build’)

--without-libtool //禁止使用libtool连接库文件

--with-efence[=DIR] //指定Electric Fence的安装目录

--with-sendfile //强制使用sendfile(译者注:Linux2.4/2.6内核都支持)

--with-egd[=DIR] //使用EDG兼容的socket

--with-devrandom[=DEV] //指定随机设备[默认为:/dev/random]
用于apr-util的configure脚本的选项:


--with-apr=PATH //指定APR的安装目录(–prefix选项值或apr-config的路径)

--with-ldap-include=PATH //ldap包含文件目录(带结尾斜线)

--with-ldap-lib=PATH //ldap库文件路径

--with-ldap=library //使用的ldap库

--with-dbm=DBM //选择使用的DBM类型DBM={sdbm,gdbm,ndbm,db,db1,db185,db2,db3,db4,db41,db42,db43,db44}

--with-gdbm=PATH //指定GDBM的位置

--with-ndbm=PATH //指定NDBM的位置

--with-berkeley-db=PATH //指定Berkeley DB的位置

--with-pgsql=PATH //指定PostgreSQL的位置

--with-mysql=PATH //参看INSTALL.MySQL文件的内容

--with-sqlite3=PATH //指定sqlite3的位置

--with-sqlite2=PATH //指定sqlite2的位置

--with-expat=PATH //指定Expat的位置或’builtin’

--with-iconv=PATH //iconv的安装目录
[/b]

[root@localhost pcre-8.10]#make clean & ./configure --prefix=/usr/local/pcre & make

&make install

【Mysql常用编译参数】

help 获取帮助

prefix 指定安装目录

without-server 只安装客户端

with-charset 默认字符集

with-extra-charsets 可选的扩展字符集

with-ndbcluster 支持mysql集群

with-big-tables 单表支持40亿条记录

with-openssl 支持openssl

[root@localhost mysql-5.1.56]# cp support-files/my-medium.cnf /etc/my.cnf

cp: overwrite `/etc/my.cnf'? y

[root@localhost mysql-5.1.56]# cd /usr/local/mysql/

[root@localhost mysql]# chown -R root .

[root@localhost mysql]# chown -R mysq var

chown: `mysq': invalid user

[root@localhost mysql]# chgrp -R mysql .

[root@localhost bin]# cd ..

[root@localhost mysql]# ls

bin docs include lib libexec mysql-test share sql-bench

[root@localhost mysql]# cd bin/

[root@localhost bin]# ./mysql_install_db --user=mysql

Installing MySQL system tables...

120229 13:38:58 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.

OK

Filling help tables...

120229 13:38:59 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.

OK

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

/usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

/usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default. This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

[root@localhost bin]# cd ..

[root@localhost mysql]# ls

bin docs include lib libexec mysql-test share sql-bench var

[root@localhost mysql]# chown -R mysql var

[root@localhost mysql]# /usr/local/mysql/bin/mysqld_safe --user=mysql &

[root@localhost mysql]# mysql -u root -p

-bash: /usr/local/bin/mysql: No such file or directory

[root@localhost mysql]# mysql -u root -p

-bash: /usr/local/bin/mysql: No such file or directory

[root@localhost mysql]# bin/mysql -u root -p

Enter password:

mysql> quit

Bye

[root@localhost mysql]# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile

[root@localhost mysql]# source /etc/profile

[root@localhost mysql]# echo "/usr/local/mysql/lib/mysql/ " >>/etc/ld.so.conf

[root@localhost mysql]# ldconfig -v

[root@localhost freetype-2.4.8]#GNUMAKE=gmake ./configure --prefix=/usr/local/freetype&&gmake &&gmake install

[root@localhost jpeg-8]# ./configure --prefix=/usr/local/jpeg&&make&&make install

[root@localhost libpng-1.2.47]# ./configure --prefix=/usr/local/libpng

checking for zlibVersion in -lz... no

configure: error: zlib not installed

[root@localhost zlib-1.2.6]# ./configure &&make &&make install

[root@localhost libpng-1.2.47]# ./configure --prefix=/usr/local/libpng&&make &&make install

[root@localhost gd-2.0.35]# ./configure --prefix=/usr/local/gd2 --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg &&make &&make install

[root@localhost php-5.3.10]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --enable-mbregex --enable-bcmath --with-mysql --with-zlib-dir --enable-mbstring=all --with-pdo-mysql --with-freetype-dir=/usr/local/freetype

hecking whether to enable LIBXML support... yes

checking libxml2 install dir... no

checking for xml2-config path...

configure: error: xml2-config not found. Please check your libxml2 installation.

[root@localhost php-5.3.10]#yum -y install libxml2-devel

[root@localhost php-5.3.10]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --enable-mbregex --enable-bcmath --with-mysql=/usrl/local/mysql --with-zlib-dir --enable-mbstring=all --with-pdo-mysql --with-freetype-dir=/usr/local/freetype

checking for MySQL support for PDO... yes

checking for mysql_config... not found

configure: error: Unable to find your mysql installation

checking for specified location of the MySQL UNIX socket... no

configure: error: Cannot find MySQL header files under yes.

Note that the MySQL client library is not bundled anymore!

make: *** [ext/gd/libgd/gd_jpeg.lo] Error 1

[root@localhost php-5.3.10]# ./configure --prefix=/usr/local/php --with-gd=/usr/local/gd2 --with-apxs2=/usr/local/apache/bin/apxs --enable-mbregex --enable-bcmath --with-mysql=/usrl/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib-dir --enable-mbstring=all --with-pdo-mysql=/usr/local/mysql/ --with-freetype-dir=/usr/local/freetype

--with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg &&make && make install

之此 LAMP 环境搭建完成

[root@localhost httpd-2.4.1]# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --with-mpm=worker --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre &make & make install

[root@localhost ~]# /usr/local/apache/bin/apachectl -l

Compiled in modules:

core.c

mod_so.c

http_core.c

worker.c


[root@localhost ~]# ls -l /usr/local/apache/modules/

total 4160

-rw-r--r-- 1 root root 12499 Feb 29 11:48 httpd.exp

-rwxr-xr-x 1 root root 27376 Feb 29 11:51 mod_access_compat.so

-rwxr-xr-x 1 root root 24718 Feb 29 11:51 mod_actions.so

-rwxr-xr-x 1 root root 35028 Feb 29 11:51 mod_alias.so

-rwxr-xr-x 1 root root 22089 Feb 29 11:51 mod_allowmethods.so

-rwxr-xr-x 1 root root 26538 Feb 29 11:51 mod_auth_basic.so

-rwxr-xr-x 1 root root 68759 Feb 29 11:51 mod_auth_digest.so

-rwxr-xr-x 1 root root 51224 Feb 29 11:51 mod_auth_form.so

-rwxr-xr-x 1 root root 23224 Feb 29 11:51 mod_authn_anon.so

-rwxr-xr-x 1 root root 29042 Feb 29 11:51 mod_authn_core.so

-rwxr-xr-x 1 root root 29391 Feb 29 11:51 mod_authn_dbd.so

-rwxr-xr-x 1 root root 24873 Feb 29 11:51 mod_authn_dbm.so

-rwxr-xr-x 1 root root 25366 Feb 29 11:51 mod_authn_file.so

-rwxr-xr-x 1 root root 38444 Feb 29 11:51 mod_authn_socache.so

-rwxr-xr-x 1 root root 44870 Feb 29 11:51 mod_authz_core.so

-rwxr-xr-x 1 root root 31552 Feb 29 11:51 mod_authz_dbd.so

-rwxr-xr-x 1 root root 27459 Feb 29 11:51 mod_authz_dbm.so

-rwxr-xr-x 1 root root 27429 Feb 29 11:51 mod_authz_groupfile.so

-rwxr-xr-x 1 root root 26305 Feb 29 11:51 mod_authz_host.so

-rwxr-xr-x 1 root root 23770 Feb 29 11:51 mod_authz_owner.so

-rwxr-xr-x 1 root root 21529 Feb 29 11:51 mod_authz_user.so

-rwxr-xr-x 1 root root 79758 Feb 29 11:51 mod_autoindex.so

-rwxr-xr-x 1 root root 26598 Feb 29 11:51 mod_buffer.so

-rwxr-xr-x 1 root root 68077 Feb 29 11:51 mod_cache_disk.so

-rwxr-xr-x 1 root root 142193 Feb 29 11:51 mod_cache.so

-rwxr-xr-x 1 root root 78606 Feb 29 11:51 mod_cgid.so

-rwxr-xr-x 1 root root 153027 Feb 29 11:51 mod_dav_fs.so

-rwxr-xr-x 1 root root 291373 Feb 29 11:51 mod_dav.so

-rwxr-xr-x 1 root root 47050 Feb 29 11:51 mod_dbd.so

-rwxr-xr-x 1 root root 28291 Feb 29 11:51 mod_dir.so

-rwxr-xr-x 1 root root 26460 Feb 29 11:51 mod_dumpio.so

-rwxr-xr-x 1 root root 23548 Feb 29 11:51 mod_env.so

-rwxr-xr-x 1 root root 30484 Feb 29 11:51 mod_expires.so

-rwxr-xr-x 1 root root 50726 Feb 29 11:51 mod_ext_filter.so

-rwxr-xr-x 1 root root 29266 Feb 29 11:51 mod_file_cache.so

-rwxr-xr-x 1 root root 41745 Feb 29 11:51 mod_filter.so

-rwxr-xr-x 1 root root 45854 Feb 29 11:51 mod_headers.so

-rwxr-xr-x 1 root root 112015 Feb 29 11:51 mod_include.so

-rwxr-xr-x 1 root root 51598 Feb 29 11:51 mod_info.so

-rwxr-xr-x 1 root root 27217 Feb 29 11:51 mod_lbmethod_bybusyness.so

-rwxr-xr-x 1 root root 27149 Feb 29 11:51 mod_lbmethod_byrequests.so

-rwxr-xr-x 1 root root 28126 Feb 29 11:51 mod_lbmethod_bytraffic.so

-rwxr-xr-x 1 root root 40243 Feb 29 11:51 mod_lbmethod_heartbeat.so

-rwxr-xr-x 1 root root 66812 Feb 29 11:51 mod_log_config.so

-rwxr-xr-x 1 root root 30475 Feb 29 11:51 mod_log_debug.so

-rwxr-xr-x 1 root root 24168 Feb 29 11:51 mod_logio.so

-rwxr-xr-x 1 root root 43077 Feb 29 11:51 mod_mime.so

-rwxr-xr-x 1 root root 77463 Feb 29 11:51 mod_negotiation.so

-rwxr-xr-x 1 root root 143946 Feb 29 11:51 mod_proxy_ajp.so

-rwxr-xr-x 1 root root 82021 Feb 29 11:51 mod_proxy_balancer.so

-rwxr-xr-x 1 root root 42914 Feb 29 11:51 mod_proxy_connect.so

-rwxr-xr-x 1 root root 32781 Feb 29 11:51 mod_proxy_express.so

-rwxr-xr-x 1 root root 50124 Feb 29 11:51 mod_proxy_fcgi.so

-rwxr-xr-x 1 root root 85941 Feb 29 11:51 mod_proxy_ftp.so

-rwxr-xr-x 1 root root 92042 Feb 29 11:51 mod_proxy_http.so

-rwxr-xr-x 1 root root 44635 Feb 29 11:51 mod_proxy_scgi.so

-rwxr-xr-x 1 root root 202989 Feb 29 11:51 mod_proxy.so

-rwxr-xr-x 1 root root 26094 Feb 29 11:51 mod_ratelimit.so

-rwxr-xr-x 1 root root 30628 Feb 29 11:51 mod_remoteip.so

-rwxr-xr-x 1 root root 36034 Feb 29 11:51 mod_reqtimeout.so

-rwxr-xr-x 1 root root 30303 Feb 29 11:51 mod_request.so

-rwxr-xr-x 1 root root 139218 Feb 29 11:51 mod_rewrite.so

-rwxr-xr-x 1 root root 91939 Feb 29 11:51 mod_sed.so

-rwxr-xr-x 1 root root 25457 Feb 29 11:51 mod_session_cookie.so

-rwxr-xr-x 1 root root 35185 Feb 29 11:51 mod_session_dbd.so

-rwxr-xr-x 1 root root 45275 Feb 29 11:51 mod_session.so

-rwxr-xr-x 1 root root 34303 Feb 29 11:51 mod_setenvif.so

-rwxr-xr-x 1 root root 30598 Feb 29 11:51 mod_slotmem_shm.so

-rwxr-xr-x 1 root root 35855 Feb 29 11:51 mod_socache_dbm.so

-rwxr-xr-x 1 root root 28837 Feb 29 11:51 mod_socache_memcache.so

-rwxr-xr-x 1 root root 50816 Feb 29 11:51 mod_socache_shmcb.so

-rwxr-xr-x 1 root root 30737 Feb 29 11:51 mod_speling.so

-rwxr-xr-x 1 root root 50187 Feb 29 11:51 mod_status.so

-rwxr-xr-x 1 root root 33133 Feb 29 11:51 mod_substitute.so

-rwxr-xr-x 1 root root 27466 Feb 29 11:51 mod_unique_id.so

-rwxr-xr-x 1 root root 25408 Feb 29 11:51 mod_unixd.so

-rwxr-xr-x 1 root root 26298 Feb 29 11:51 mod_userdir.so

-rwxr-xr-x 1 root root 18429 Feb 29 11:51 mod_version.so

-rwxr-xr-x 1 root root 31494 Feb 29 11:51 mod_vhost_alias.so


[root@localhost mysql-5.1.56]# ./configure --without-server --with-extra-charsets=gbk,gb2312,utf8 --enable-thread-safe-client

checking for termcap functions library... configure: error: No curses/termcap library found

[root@localhost mysql-5.1.56]# yum install ncurses-devel

[root@localhost mysql-5.1.56]# ./configure --prefix=/usr/local/mysql --with-extra-charsets=gbk,gb2312,utf8 --enable-thread-safe-client & make & make install

[root@localhost php-5.3.10]# cp php.ini-development /usr/local/php/lib/php/php.ini

[root@localhost php-5.3.10]# cp php.ini-development /usr/local/php/lib/php.ini


[root@localhost modules]# vi /usr/local/apache/conf/httpd.conf

<IfModule mime_module>

AddType application/x-httpd-php .php

解决PHP空白页问题

<?php

header("Content-Type: text/html;charset=gb2312");

phpinfo () ;

?>

本文出自 “IT” 博客,请务必保留此出处http://benly.blog.51cto.com/460663/792575
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: