mysql php apache 整合
# wget http://archive.apache.org/dist/httpd/httpd-2.4.1.tar.gz# wget http://files.directadmin.com/services/all/mysql/mysql-5.5.20.tar.gz
# wget http://mirror.yongbok.net/nongnu/freetype/freetype-2.4.8.tar.gz
# wget http://www.ijg.org/files/jpegsrc.v8.tar.gz
# wget http://cdnetworks-kr-2.dl.sourceforge.net/project/libpng/libpng12/1.2.47/libpng-1.2.47.tar.gz
下载gd-2.0.35
# ./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.
# rpm -qa | grep apr
# yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
# tar zxvf apr-1.4.5.tar.gz
# cd apr-1.4.5
# ./configure --prefix=/usr/local/apr
# ./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.
#yum -y install gcc
# ./configure --prefix=/usr/local/apr
#make & make install
# ./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.
# tar zxvf apr-util-1.3.12.tar.gz
# cd apr-util-1.3.12
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config &make &make install
# ./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/
# cd 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: *** Error 1
make: Leaving directory `/root/pcre-8.10'
make: *** Error 2
# 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时需要。
用于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的安装目录
#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
# cp support-files/my-medium.cnf /etc/my.cnf
cp: overwrite `/etc/my.cnf'? y
# cd /usr/local/mysql/
# chown -R root .
# chown -R mysq var
chown: `mysq': invalid user
# chgrp -R mysql .
# cd ..
# ls
bindocsincludeliblibexecmysql-testsharesql-bench
# cd bin/
# ./mysql_install_db --user=mysql
Installing MySQL system tables...
120229 13:38:58 '--skip-locking' is deprecated and will be removed in a future> OK
Filling help tables...
120229 13:38:59 '--skip-locking' is deprecated and will be removed in a future> 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!
# cd ..
# ls
bindocsincludeliblibexecmysql-testsharesql-benchvar
# chown-R mysql var
# /usr/local/mysql/bin/mysqld_safe --user=mysql &
# mysql -u root -p
-bash: /usr/local/bin/mysql: No such file or directory
# mysql -u root -p
-bash: /usr/local/bin/mysql: No such file or directory
# bin/mysql -u root -p
Enter password:
mysql> quit
Bye
# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
# source /etc/profile
# echo "/usr/local/mysql/lib/mysql/ " >>/etc/ld.so.conf
# ldconfig -v
#GNUMAKE=gmake ./configure --prefix=/usr/local/freetype&&gmake &&gmake install
# ./configure --prefix=/usr/local/jpeg&&make&&make install
# ./configure --prefix=/usr/local/libpng
checking for zlibVersion in -lz... no
configure: error: zlib not installed
# ./configure &&make &&make install
# ./configure --prefix=/usr/local/libpng&&make &&make install
# ./configure --prefix=/usr/local/gd2 --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg &&make &&make install
# ./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.
#yum -y install libxml2-devel
# ./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: *** Error 1
# ./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 环境搭建完成
# ./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
# /usr/local/apache/bin/apachectl -l
Compiled in modules:
core.c
mod_so.c
http_core.c
worker.c
# ls -l /usr/local/apache/modules/
total 4160
-rw-r--r-- 1 root root12499 Feb 29 11:48 httpd.exp
-rwxr-xr-x 1 root root27376 Feb 29 11:51 mod_access_compat.so
-rwxr-xr-x 1 root root24718 Feb 29 11:51 mod_actions.so
-rwxr-xr-x 1 root root35028 Feb 29 11:51 mod_alias.so
-rwxr-xr-x 1 root root22089 Feb 29 11:51 mod_allowmethods.so
-rwxr-xr-x 1 root root26538 Feb 29 11:51 mod_auth_basic.so
-rwxr-xr-x 1 root root68759 Feb 29 11:51 mod_auth_digest.so
-rwxr-xr-x 1 root root51224 Feb 29 11:51 mod_auth_form.so
-rwxr-xr-x 1 root root23224 Feb 29 11:51 mod_authn_anon.so
-rwxr-xr-x 1 root root29042 Feb 29 11:51 mod_authn_core.so
-rwxr-xr-x 1 root root29391 Feb 29 11:51 mod_authn_dbd.so
-rwxr-xr-x 1 root root24873 Feb 29 11:51 mod_authn_dbm.so
-rwxr-xr-x 1 root root25366 Feb 29 11:51 mod_authn_file.so
-rwxr-xr-x 1 root root38444 Feb 29 11:51 mod_authn_socache.so
-rwxr-xr-x 1 root root44870 Feb 29 11:51 mod_authz_core.so
-rwxr-xr-x 1 root root31552 Feb 29 11:51 mod_authz_dbd.so
-rwxr-xr-x 1 root root27459 Feb 29 11:51 mod_authz_dbm.so
-rwxr-xr-x 1 root root27429 Feb 29 11:51 mod_authz_groupfile.so
-rwxr-xr-x 1 root root26305 Feb 29 11:51 mod_authz_host.so
-rwxr-xr-x 1 root root23770 Feb 29 11:51 mod_authz_owner.so
-rwxr-xr-x 1 root root21529 Feb 29 11:51 mod_authz_user.so
-rwxr-xr-x 1 root root79758 Feb 29 11:51 mod_autoindex.so
-rwxr-xr-x 1 root root26598 Feb 29 11:51 mod_buffer.so
-rwxr-xr-x 1 root root68077 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 root78606 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 root47050 Feb 29 11:51 mod_dbd.so
-rwxr-xr-x 1 root root28291 Feb 29 11:51 mod_dir.so
-rwxr-xr-x 1 root root26460 Feb 29 11:51 mod_dumpio.so
-rwxr-xr-x 1 root root23548 Feb 29 11:51 mod_env.so
-rwxr-xr-x 1 root root30484 Feb 29 11:51 mod_expires.so
-rwxr-xr-x 1 root root50726 Feb 29 11:51 mod_ext_filter.so
-rwxr-xr-x 1 root root29266 Feb 29 11:51 mod_file_cache.so
-rwxr-xr-x 1 root root41745 Feb 29 11:51 mod_filter.so
-rwxr-xr-x 1 root root45854 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 root51598 Feb 29 11:51 mod_info.so
-rwxr-xr-x 1 root root27217 Feb 29 11:51 mod_lbmethod_bybusyness.so
-rwxr-xr-x 1 root root27149 Feb 29 11:51 mod_lbmethod_byrequests.so
-rwxr-xr-x 1 root root28126 Feb 29 11:51 mod_lbmethod_bytraffic.so
-rwxr-xr-x 1 root root40243 Feb 29 11:51 mod_lbmethod_heartbeat.so
-rwxr-xr-x 1 root root66812 Feb 29 11:51 mod_log_config.so
-rwxr-xr-x 1 root root30475 Feb 29 11:51 mod_log_debug.so
-rwxr-xr-x 1 root root24168 Feb 29 11:51 mod_logio.so
-rwxr-xr-x 1 root root43077 Feb 29 11:51 mod_mime.so
-rwxr-xr-x 1 root root77463 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 root82021 Feb 29 11:51 mod_proxy_balancer.so
-rwxr-xr-x 1 root root42914 Feb 29 11:51 mod_proxy_connect.so
-rwxr-xr-x 1 root root32781 Feb 29 11:51 mod_proxy_express.so
-rwxr-xr-x 1 root root50124 Feb 29 11:51 mod_proxy_fcgi.so
-rwxr-xr-x 1 root root85941 Feb 29 11:51 mod_proxy_ftp.so
-rwxr-xr-x 1 root root92042 Feb 29 11:51 mod_proxy_http.so
-rwxr-xr-x 1 root root44635 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 root26094 Feb 29 11:51 mod_ratelimit.so
-rwxr-xr-x 1 root root30628 Feb 29 11:51 mod_remoteip.so
-rwxr-xr-x 1 root root36034 Feb 29 11:51 mod_reqtimeout.so
-rwxr-xr-x 1 root root30303 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 root91939 Feb 29 11:51 mod_sed.so
-rwxr-xr-x 1 root root25457 Feb 29 11:51 mod_session_cookie.so
-rwxr-xr-x 1 root root35185 Feb 29 11:51 mod_session_dbd.so
-rwxr-xr-x 1 root root45275 Feb 29 11:51 mod_session.so
-rwxr-xr-x 1 root root34303 Feb 29 11:51 mod_setenvif.so
-rwxr-xr-x 1 root root30598 Feb 29 11:51 mod_slotmem_shm.so
-rwxr-xr-x 1 root root35855 Feb 29 11:51 mod_socache_dbm.so
-rwxr-xr-x 1 root root28837 Feb 29 11:51 mod_socache_memcache.so
-rwxr-xr-x 1 root root50816 Feb 29 11:51 mod_socache_shmcb.so
-rwxr-xr-x 1 root root30737 Feb 29 11:51 mod_speling.so
-rwxr-xr-x 1 root root50187 Feb 29 11:51 mod_status.so
-rwxr-xr-x 1 root root33133 Feb 29 11:51 mod_substitute.so
-rwxr-xr-x 1 root root27466 Feb 29 11:51 mod_unique_id.so
-rwxr-xr-x 1 root root25408 Feb 29 11:51 mod_unixd.so
-rwxr-xr-x 1 root root26298 Feb 29 11:51 mod_userdir.so
-rwxr-xr-x 1 root root18429 Feb 29 11:51 mod_version.so
-rwxr-xr-x 1 root root31494 Feb 29 11:51 mod_vhost_alias.so
# ./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
# yum install ncurses-devel
# ./configure --prefix=/usr/local/mysql --with-extra-charsets=gbk,gb2312,utf8 --enable-thread-safe-client & make & make install
# cp php.ini-development /usr/local/php/lib/php/php.ini
# cp php.ini-development /usr/local/php/lib/php.ini
# vi /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
解决PHP空白页问题
页:
[1]