========================================================================================
PS: 生产环境必须都安装GA版本……很多配置还很不成熟……还需要不断完善和改进……
tar xf mysql-5.1.36.tar.gz -C /usr/src/ ./configure --prefix=/usr/local/mysql --enable-local-infile --with-charset=utf8 --with-extra-charsets=gb2312,gbk,utf8 --with-pthread --with-unix-socket-path=/var/run/mysqld/mysql5.socket --with-mysqld-user=mysql --with-debug --with-big-tables --with-plugins=myisam,myisammrg,heap,innobase,ndbcluster --with-mysqlmanager make && make install
vim my.cnf [mysqld] user=mysql basedir=/usr/local/mysql datadir=/database socket=/var/run/mysqld/mysql5.socket pid-file=/var/run/mysqld/mysql5.pid general-log general-log-file=/var/log/mysqld/mysql5-access.log log-error=/var/log/mysqld/mysql5-error.log port=3306
chown mysql:mysql /var/run/mysqld/ /database/ /var/log/mysqld /usr/local/mysql/ -R /usr/local/mysql/bin/mysql_install_db --datadir=database/ cp /usr/src/mysql-5.1.36/support-files/mysql.server /etc/rc.d/init.d/mysql vim /etc/rc.d/init.d/mysql datadir= basedir= pid_file= conf= servicd mysql start mysql -u root -p
sql>show engines; // no innodb!
service mysql stop rsync -av /database /backup/database rsync -av /usr/local/mysql/ /backup/basedir/ rm -rf /database/ rm -rf /usr/local/mysql/ tar xf mysql-5.5.29.tar.gz -C /usr/src/ yum install -y cmake cd /usr/src/mysql-5.5.29/;cmake -LH &> help cmake -DMYSQL_DATADIR:PATH=/database -DWITH_DEBUG:BOOL=ON -DWITH_EXTRA_CHARSETS:STRING=all mkdir /database;chown mysql:mysql /database -R make && make install cd /usr/local/mysql/ mkdir etc cd etc/ vim my.cnf [mysqld] user=mysql basedir=/usr/local/mysql datadir=/database socket=/var/run/mysqld/mysql5.socket pid-file=/var/run/mysqld/mysql5.pid general-log general-log-file=/var/log/mysqld/mysql5-access.log log-error=/var/log/mysqld/mysql5-error.log port=3306 rm -rf /var/log/mysqld/mysql5-access.log rm -rf /var/log/mysqld/mysql5-error.log cp /usr/src/mysql-5.5.29/support-files/mysql.server /etc/rc.d/init.d/mysql5 chmod 755 /etc/rc.d/init.d/mysql5 /usr/src/mysql-5.5.29/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/database/ vim /etc/rc.d/init.d/mysql5 service mysql5 start vim /etc/my.cnf [mysql] socket=/var/run/mysqld/mysql5.socket mysql -u root -p /usr/local/mysql/bin/mysql_upgrade --socket=/var/run/mysqld/mysql5.socket mysql -u root -p sql>show engines; // innodb yes!
libevent \ echo "/usr/local/lib" > /etc/ld.so.conf.d/lamp.conf \ ldconfig yum install -y openssl* nss-devel bzip2-devel libzip-* net-snmp-* //刚开始忘了装 tar xf apr-1.4.6.tar.gz -C /usr/src/ ./configure --disable-ipv6 --enable-threads tar xf libiconv-1.14.tar.gz -C /usr/src/ ./configure --enable-static tar xf apr-iconv-1.2.1.tar.gz -C /usr/src/ ./configure --with-apr=/usr/local/apr/bin/apr-1-config tar xf apr-util-1.5.1.tar.gz -C /usr/src/ cd apr-util-1.5.1/ ln -s /usr/src/apr-iconv-1.2.1/ /usr/src/apr-util-1.5.1/apr-iconv ./configure --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-iconv=./apr-iconv/ --with-openssl=/usr/ \ --with-nss=/usr/ --with-mysql=/usr/local/mysql/ --with-iconv=/usr/local/ tar xf pcre-8.32.tar.gz -C /usr/src/ ./configure --enable-rebuild-chartables --enable-utf8 --enable-newline-is-any --enable-pcregrep-libz --enable-pcregrep-libbz2 (libtool: link: cannot find the library `/usr/src/apr-util-1.5.1/./apr-iconv/lib/libapriconv.la' or unhandled argument `/usr/src/apr-util-1.5.1/./apr-iconv/lib/libapriconv.la')编译apache报错了! ln -s /usr/src/apr-util-1.5.1/./apr-iconv/lib/libapriconv-1.la /usr/src/apr-util-1.5.1/./apr-iconv/lib/libapriconv.la tar xf httpd-2.4.3.tar.gz -C /usr/src/ ./configure --prefix=/usr/local/apache2 \ --enable-modules=all \ --enable-mods-shared=all \ --enable-charset-lite \ --enable-unique-id \ --disable-version \ --with-mpm=prefork \ --enable-http \ --enable-proxy-balancer \ --enable-static-rotatelogs \ --enable-static-htpasswd \ --enable-static-htdigest \ --enable-static-logresolve \ --enable-static-htdbm \ --enable-static-ab \ --enable-static-checkgid \ --enable-static-htcacheclean \ --enable-cgi \ --enable-vhost-alias \ --enable-rewrite \ --enable-so \ --enable-usertrack \ --enable-cgi \ --enable-mime-magic \ --with-apr=/usr/local/apr/bin/apr-1-config \ --with-apr-util=/usr/local/apr/bin/apu-1-config \ --with-pcre=/usr/local \ --with-ssl=/usr ./configure --enable-modules=all --enable-mods-shared=all --enable-file-cache --enable-cache --enable-dumpio --enable-echo --enable-example-hooks --enable-example-ipc --enable-logio --enable-mime-magic --enable-expires --enable-unique-id --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-proxy-ajp --enable-proxy-connect --enable-ssl --enable-static-ab --enable-http --enable-info --enable-cgi --enable-vhost-alias --enable-so --enable-rewrite --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-pcre=/usr/local/ --with-ssl=/usr/ --with-mpm=prefork make && make install libtool: install: warning: `/usr/src/apr-util-1.5.1/./apr-iconv//lib/libapriconv.la' has not been installed in `/usr/local/apache2/lib' //安装成功了,最后报个小错!呵呵……
1.zh-CN /usr/local//apache2/conf//httpd.conf \-->Include conf/extra/httpd-languages.conf //取消注释 httpd-languages.conf \-->DefaultLanguage zh-CN \->LanguagePriority zh-CN ...... (Load modules mod_mime and mod_negotiation) 2.vhosts /usr/local//apache2/conf//httpd.conf \-->Include conf/extra/httpd-vhosts.conf httpd-vhosts.conf ------------------> NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin taolr@ln_credbile.cn DocumentRoot "/www" ServerName taolr.ln_credbile.cn ErrorLog "/var/log/httpd/lin-error.log" CustomLog "/var/log/httpd/lin-access.log" common </VirtualHost> ------------------> mkdir /www;chown daemon:daemon /www -R 3.404 /usr/local//apache2/conf//httpd.conf \-->ErrorDocument 404 /404.html 把所有的图片显示为 “/” 下! 4.允许访问 <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Allow from all ///将 Deny改成 Allow </Directory> <Directory /> # AllowOverride none # Require all denied AllowOverride none Require all granted </Directory> 5.索引 写索引页的时候,至少要有简单的结构!否则某些浏览器访问可能会出问题! httpd.conf DirectoryIndex index.html index.php 6.监控 /usr/local//apache2/conf//httpd.conf Include conf/extra/httpd-info.conf httpd-info.conf --------------------------> <Location /server-status> SetHandler server-status # Require host Require ip 192.168.10.0/255.255.255.0 </Location> ExtendedStatus on ///这个需要打开,否则无法监控 CPU! ---------------------------> mkdir /var/log/httpd yum install -y lynx LoadModule slotmem_shm_module modules/mod_slotmem_shm.so LoadModule slotmem_plain_module modules/mod_slotmem_plain.so //一直apache启动不起来,原来是这个模块没添加! httpd -v ///查看了相关的参数,原来我的错如日志在 logs/error-log 查看这儿就能得到了! ///注意,查虚拟主机里面的错误日志是没用的!
unzip ft2411.zip yum install -y unzip zip ./configure (wrong) yum install -y dos2unix dos2unix configure cd /usr/src/freetype.2../builds/unix dos2unix * ./configure 转到 freetype目录下,然后 make && make install---------------------------------------------------
tar xf libpng-1.2.16.tar.gz -C /usr/src/ ./configure --with-pkgconfigdir=/usr/lib64/pkgconfig/ tar xf jpegsrc.v8c.tar.gz -C /usr/src/ ./configure && make && make install 以上三个软件,也即三种图片,为php的库gd而安装的 yum install -y libjpeg-devel freetype-devel libpng-devel //like this!-----------------------------------------------
yum install -y imake yum install -y libX11-devel yum install -y libXt-devel yum install -y libxcb-devel yum install -y libXext-devel yum install -y libgnomecanvas-devel xmkmf -a make && make install make install.man-----------------------------------------------
tar xf gd-2.0.36RC1.tar.gz -C /usr/src/ ./configure --with-libiconv-prefix=/usr/local/ --with-png=/usr/local/ --with-freetype=/usr/local/ --with-fontconfig=/usr/ --with-jpeg=/usr/local/ --with-xpm=/usr/local/
tar xf libmcrypt-2.5.7.tar.gz -C /usr/src/ ./configure --enable-static tar xf mhash-0.9.9.9.tar.gz -C /usr/src/ ./configure tar xf mcrypt-2.6.8.tar.gz -C /usr/src/ ./configure --with-libiconv-prefix=/usr/local --with-libmcrypt-prefix=/usr/local configure: error: *** libmcrypt was not found ///ldconfig 之后继续! yum install -y libxml2 libcurl-devel-------------------------------------------------------------------------------
yum reinstall -y openssl openssl-devel cp /usr/local/lib/libpcre.a /usr/libpcre.a cp /usr/local/lib/libpcre.so /usr/libpcre.so cp /usr/local/lib/libpcre.* /usr/local/lib64/ cp /usr/local/lib/libgd.* /usr/local/lib64/
在编译PHP5.2以上版本,经常会看到如下错误,常常以为是PHP的./configure后边什么参数没有写对,很让人费解
cp -rp /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so ///不行 [root@mysql new]# ln -s /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib64/libmysqlclient.so [root@mysql new]# rm -rf /usr/lib/libmysqlclient.so [root@mysql new]# ln -s /usr/lib64/libmysqlclient.so /usr/lib/libmysqlclient.so ///依然不行 [root@mysql lib]# ln -s /usr/lib64/mysql/libmysqlclient.so.16.0.0 ./libmysqlclient.so===================================================================================================
./configure --with-apxs2=/usr/local/apache2/bin/apxs --disable-ipv6 --with-libxml-dir=/usr --with-openssl=/usr --with-pcre-regex=/usr/local --with-zlib=/usr --with-bz2=/usr --enable-calendar --with-curl=/usr --with-pcre-dir=/usr/local --enable-ftp --with-openssl-dir=/usr --with-gd=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-xpm-dir=/usr --with-freetype-dir=/usr/local --enable-gd-native-ttf --enable-gd-jis-conv --with-mhash=/usr/local --enable-mbstring --with-mcrypt=/usr/local --with-mysql --with-mysql-sock=/var/run/mysqld/mysql5.socket --with-mysqli=/usr/local/mysql/bin/mysql_config --with-snmp=/usr/ --enable-sockets --enable-zip --with-libdir=/lib64 -------->之前 这儿写错了一个单词 mysql-->myql
-----------------------------------------------------------------------
转载部分
64位Linux上编译php时mysql报错一例 2012年06月04日 ? Linux, 操作系统 ? 共 293字 ? 暂无评论 在64位Linux上编译php时,一般需要加入mysql支持,请务必记住加入--with-libdir=/lib64 参数,以保证configure正确发现mysql。 典型的编译语句如下: ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-libdir=/lib64 如果你没加该参数,将会出现以下错误: configure: error: Cannot find libmysqlclient under /usr. Note that the MySQL client library is not bundled anymore!-----------------------------------------------------------------------------
./configure --with-apxs2=/usr/local/apache2/bin/apxs --disable-ipv6 --with-libxml-dir=/usr --with-openssl=/usr --with-pcre-regex=/usr/local --with-zlib=/usr --with-bz2=/usr --enable-calendar --with-curl=/usr --with-pcre-dir=/usr/local --enable-ftp --with-openssl-dir=/usr --with-gd=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-xpm-dir=/usr --with-freetype-dir=/usr/local --enable-gd-native-ttf --enable-gd-jis-conv --with-mhash=/usr/local --enable-mbstring --with-mcrypt=/usr/local --with-mysql --with-mysql-sock=/var/run/mysqld/mysql5.socket --with-mysqli=/usr/local/mysql/bin/mysql_config --with-snmp=/usr/ --enable-sockets --enable-zip --with-libdir=/lib64 --enable-maintainer-zts make && make install
====================================================================经过上面的倒腾,game over!!!
===============后来在32位机器上又编译一次. --with-mysql=/usr/loca/mysql 这个!我记着了!
===============再一次编译, 我甚至放弃了 openssl装了又卸, 卸了又装---
===============LAMP的高效配置很重要, 对我来说还是效率太低了! Coding!
cp /usr/src/php-5.4.11/php.ini-production /usr/local/lib/php.ini -----------------php.ini 1. session session.save_path = "/tmp/session" // mkdir /tmp/session ;chown daemon:daemon /tmp/session 2. support mysql mysql.default_socket = /var/run/mysqld/mysql5.socket //php4的语法(面向过程) mysqli.default_socket = /var/run/mysqld/mysql5.socket //php5的语法(面向对象) 3. upload file limit upload_max_filesize = 4M //修改论坛上传附件的大小限制!默认2M --------------/usr/local/apache2/conf/httpd.conf LoadModule php5_module modules/libphp5.so ///确认php是否安装成功! AddType application/x-httpd-php .php .phtml //add them! AddType application/x-httpd-php-source .phpsvim /www/index.php
===============================================================================
见笔者之前的博文 PHP补丁
create database wordpress; grant all on wordpress.* to 'wordpress'@'10.10.24.%' identified by 'wordpress'; //wrong,改成192.168.10.% revoke all on wordpress.* from 'wordpress'@'10.10.24.%'; //Then flush privileges and commit!] flush privileges;
options { listen-on port 53 { any; }; direcotry "/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; }; }; logging { channel default_debugs { file "data/named.run"; severity dynamic; }; zone "." IN { type hint; file "named.ca"; }; zone "ln_credbile.cn" IN { type master; file "ln_credbile.cn.zone"; allow-update { none; }; };-----------------------
$TTL 86400 @ IN SOA taolr.ln_credbile.cn. taolr.ln_credbile.cn ( 20130203 ; serial 3H ; refresh 15M ; retry 1W ; expire 1D ) ; minimum IN NS taolr.ln_credbile.cn. taolr IN A 192.168.10.112 bbs IN A 192.168.10.112 wordpress IN A 192.168.10.112---------------------------------------
<VirtualHost 192.168.10.112> ServerAdmin taolr@ln_credbile.cn DocumentRoot "/www/bbs" ServerName bbs.ln_credbile.cn ErrorLog "/var/log/httpd/bbs-error.log" CustomLog "/var/log/httpd/bbs-access.log" combined <Directory "/www/bbs"> Options Indexes AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost 192.168.10.112> ServerAdmin taolr@ln_credbile.cn DocumentRoot "/www/wordpress" ServerName wordpress.ln_credbile.cn ErrorLog "/var/log/httpd/bbs-error.log" CustomLog "/var/log/httpd/bbs-access.log" combined <Directory "/www/wordpress"> Options Indexes AllowOverride None Order allow,deny AuthName "wordpress" AuthType Basic AuthUserFile /usr/local/apache2/conf/.htpasswd Require valid-user Allow from all </Directory> </VirtualHost>