目前共有1篇帖子。 內容轉換:不轉換▼
 
點擊 回復
468 0
[Ubuntu]Ubuntu手工编译安装PHP5(gd)+MYSQL5+Apache2(mod_re
UTC+13:00
張樹人
中級工程師 十級
1樓 發表于:2011-2-11 02:58
今天在Ubuntu 8.10里手动编译了php5+MySQL5+Apache2,编译好的PHP5支持GD、apache支持URL重写(mod_rewrite)。
你还可以看看《openSUSE 11.0安装PHP5+MYSQL5+APACHE2全记录》和《Red Hat Enterprise Linux 5安装LAMP》
以下是编译过程,其中的诸如mysql-5.0.67.tar.gz之类的源码包,可以直接在GOOLGE搜索:在搜索框输入mysql-5.0.67.tar.gz即可。

安装 ncurses:
sudo apt-get install libncurses5-dev

安装MYSQL
sudo groupadd mysql
sudo useradd -g mysql -d /usr/local/mysql/data  mysql
tar -zxvf mysql-5.0.67.tar.gz
cd mysql-5.0.67
./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/usr/local/mysql/data --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --with-extra-charsets=all
make
sudo make install
sudo /usr/local/mysql/bin/mysql_install_db
sudo chown -R mysql:mysql /usr/local/mysql/data
sudo cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
sudo update-rc.d mysqld defaults
sudo cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
sudo ln -s /usr/local/mysql/bin/mysql /bin/mysql
sudo /etc/init.d/mysqld start
mysql

安装apache
tar -zvxf httpd-2.2.10.tar.gz
cd httpd-2.2.10
./configure --prefix=/usr/local/apache --enable-so --enable-rewrite
make
sudo make install
#编译rewrite模块
tar -zxvf gdbm-1.8.3.tar.gz
./configure
make
sudo make install
sudo make install-compat
cd /home/lly/install/php/httpd-2.2.10/modules/mappers/
sudo /usr/local/apache/bin/apxs -c mod_rewrite.c -lgdbm
sudo gcc -shared -o mod_rewrite.so mod_rewrite.o -lgdbm
sudo /usr/local/apache/bin/apxs -i -A -n rewrite mod_rewrite.so
sudo  cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
sudo update-rc.d httpd defaults
sudo /etc/init.d/httpd start

建立目录
sudo -p mkdir /usr/local/modules/jpeg6/man/man1
sudo mkdir /usr/local/modules/jpeg6/bin
sudo mkdir /usr/local/modules/jpeg6/lib
sudo mkdir /usr/local/modules/jpeg6/include

安装zlib

安装libxml2
sudo apt-get install libxml2-dev

安装freetype
tar -xvf freetype-2.3.7.tar.bz2
cd freetype-2.3.7
./configure --prefix=/usr/local/modules/freetype
make
sudo make install

安装libpng
tar xzvf libpng-1.2.5.tar.gz
cd libpng-1.2.5
cp scripts/makefile.std makefile
make
sudo make install

安装JPEG
tar xzvf jpegsrc.v6b.tar.gz
./configure --prefix=/usr/local/modules/jpeg6 --enable-shared --enable-static
make
sudo make install

安装gettext

安装GD
tar xzvf gd-2.0.33.tar.gz
./configure --prefix=/usr/local/modules/gd --with-jpeg=/usr/local/modules/jpeg6 --with-png --with-zlib --with-freetype=/usr/local/modules/freetype
make
sudo make install

安装mcrypt --为了使用phpMyAdmin
tar zxvf libmcrypt-2.5.7.tar.gz
./configure --prefix=/usr/local
make
sudo make install

安装PHP
tar xvf php-5.2.8.tar.bz2
cd php-5.2.8/
./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/lib --with-gd=/usr/local/modules/gd --with-jpeg-dir=/usr/local/modules/jpeg6 --with-zlib --with-png-dir --with-freetype-dir=/usr/local/modules/freetype --with-xmlrpc --with-config-file-path=/usr/local/php5/etc --enable-sockets --with-mcrypt=/usr/local/lib

#vim libtool
#deplibs_check_method="pass_all"
make #如果make出错,请执行上面2行
sudo make install
sudo cp ./php.ini-dist /usr/local/php5/etc/php.ini
sudo vim /usr/local/apache/conf/httpd.conf
加载php模块,去掉注释“#”,如没有此行,请加上。
LoadModule php5_module        modules/libphp5.so
加上此两行
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

DirectoryIndex index.php index.html
sudo /usr/local/apache/bin/httpd -k restart

安装ZendOptimizer
tar -zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
cd ZendOptimizer-3.3.3-linux-glibc23-i386
sudo ./install.sh
*/usr/local/php5/etc
*/usr/local/apache/bin/apachectl

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
(快捷鍵:Ctrl+Enter)
 

本帖信息

點擊數:468 回複數:0
評論數: ?
作者:張樹人
最後回復:張樹人
最後回復時間:2011-2-11 02:58
 
©2010-2024 Arslanbar Ver2.0
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。