我是小佳 ,未注明原创的,均为转载。
老外写的:how to install/compile Apache2, PHP5 and MySQL 4.1 on Linux
上一篇 /
下一篇 2006-11-20 22:46:29
/ 个人分类:Linux
| Author: | Michael Kofler |
| Date: | 2004/8/27 |
This text explains the installation of MySQL 4.1.3 and the compilation of Apache 2 and PHP 5. I have done this on a SUSE 9.1 system, but these instructions should also apply to other Linux distributions.
Please note: This text is intended for advanced Linux users. You will get only a minimal PHP and Apache system. If you want to use extra components, you must add some more options during ./configure.
-------
To begin with:
- You need all usual developer tools (compiler, make etc.)
- You have to de-install all Apache-, PHP- and MySQL packages (for example with YaST or with rpm -e).
-------
Installation MySQL 4.1.3
download these RPMs from http://www.mysql.com
MySQL-server-4.1.3-1
MySQL-devel-4.1.3-1
MySQL-client-4.1.3-1
MySQL-shared-4.1.3-1
install them with rpm -i MySQL*.rpm
-------
Download these files (or newer versions) to /usr/local/src
zlib-1.2.1.tar.gz from http://www.gzip.org/zlib/
libxml2-2.6.10.tar.gz from http://www.xmlsoft.org/
php-5.0.1.tar.bz2 from http://www.php.net/downloads.php
httpd-2.0.50.tar.gz from http://httpd.apache.org/
-------
Decompress the files
cd /usr/local/src
tar xzf zlib-1.2.1.tar.gz
tar xzf libxml2-2.6.10.tar.gz
tar xzf httpd-2.0.50.tar.gz
tar xjf php-5.0.1.tar.bz2
-------
compile zlib, install to /usr/local/lib
cd zlib-1.2.1/
./configure
make
make install
cd ..
-------
compile libxml2, install to /usr/local/lib
cd libxml2-2.6.10
./configure
make
make install
cd ..
-------
compile apache2, install to /usr/local/apache2
cd httpd-2.0.50
./configure --prefix=/usr/local/apache2 --enable-so
make
make install
cd ..
to start / stop Apache execute:
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl stop
Apache config directory:
/usr/local/apache2/conf/
htdocs directory:
/usr/local/apache2/htdocs/
-------
compile PHP5, install to /usr/local/php5
cd php-5.0.1
./configure --prefix=/usr/local/php5 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-libxml-dir=/usr/local/lib --with-zlib \
--with-zlib-dir=/usr/local/lib \
--with-mysql=/usr --with-mysqli=/usr/bin/mysql_config \
--with-gd --enable-soap --enable-sockets \
--with-jpeg-dir=/usr --enable-exif
make
.. gave me lots of 'multiple defined' error for libmysql;
these errors go away if you drop either --with-mysql or
--with-mysqli;
if you want to use both the old mysql and the new mysqli
interface, load the Makefile into your editor and search
for the line beginning with EXTRA_LIBS; it includes
-lmysqlclient twice; remove the second instance
make
make install
cd ..
location of php.ini:
/usr/local/php5/lib/
per default, php.ini does not exist; you find sample ini
files in /usr/src/php-5.0.1
-------
change Apache's httpd.conf to make it use PHP
the command make install of the PHP build automatically
adds the following line to /usr/local/apache2/conf/httpd.conf:
LoadModule php5_module modules/libphp5.so
however, you have to add another line:
AddType application/x-httpd-php .php
-------
test it all
restart Apache
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl stop
create the file
/usr/local/apache2/htdocs/test.php
with this content
<?php phpinfo(); ?>
load the page with your web browser
http://localhost/test.php an
-------
start Apache automatically (Init-V)
if Apache should start automatically when you start
your system, you have to add a init scrīpt; if you use
SUSE, copy /etc/init.d/skeleton to /etc/init.d/apache2
and adapt it according to your needs; the following lines
summarize the most important parts
#! /bin/sh
# /etc/init.d/apache2
...
case "$1" in
start)
echo -n "Starting apache2"
/usr/local/apache2/bin/apachectl start
rc_status -v
;;
stop)
echo -n "Shutting down apache2"
/usr/local/apache2/bin/apachectl stop
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
...
-------
for even more details see:
http://php.net/manual/en/install.unix.php
http://www.php.net/manual/en/install.apache2.php
http://builder.com.com/5100-6374_14-5290304.html
http://howto.pointbeing.net/index.php/installphp5/
http://www.protonicdesign.com/tutorial/libxml_and_php5.php
导入论坛
收藏
分享给好友
管理
举报
TAG:
Linux