`

fedora6+apache2+mysql5+php5+GD+Zend+phpMyAdmin

阅读更多

建议在安装前卸载redhat或dedora自带的apache ,php, mysql,否则安装的是后会出问题(主要针对基于redhat的linux)。
LAMP 安装说明
php5.0 要求libxml2-2.6.0以上更高的版本,这一解析器提供php5.0 新的XML API
===============================================================================================================================================
安装 libxml2
tar -zxvf libxml2-2.6.19.tar.gz
cd libxml2-2.6.19
./configure --prefix=/usr/local/libxml2
make
make install
这一步结束时,libxml2被安装在/usr/local/下。
================================================================================================================================================
安装 zlib
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install
这一步结束时,zlib被安装在/usr/local/下。
===============================================================================================================================================
安装 libpng
tar -zxvf libpng-1.2.10.tar.gz
cd libpng-1.2.10
cp scripts/makefile.linuxmakefile
make
make install
注意:这里的makefile不是用./configure 生成的,而是直接从script/目录里拷一个
这一步结束时,zlib被安装在/usr/local/lib下
=============================================================================================================================================
安装 freetype
tar -zxvf freetype-2.2.1.tar.gz
cd freetype-2.2.1
./configure --prefix=/usr/local/freetype
make
make install
这一步结束时,freetype被安装在/usr/local/lib下
============================================================================================================================================

安装 jpeg6
建立目录
mkdir /usr/local/jpeg6
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/lib
mkdir /usr/local/jpeg6/include
mkdir /usr/local/jpeg6/man
mkdir /usr/local/jpeg6/man/man1
tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
make
make install
注意:这里./configure一定要带--enable-shared参数,不然,不会生成共享库
=============================================================================================================================================
安装 gd
tar -zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd --with-png=/usr/local/lib --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6
make && make install
==============================================================================================================================================
安装 curl 支持ftp库函数
tar -zxvf curl-7.15.0.tar.gz
cd curl-7.15.0
./configure --prefix=/usr/local/curl
make && make install
===============================================================================================================================================
安装 Apache2
以Apache使用php有两种方式:作为动态模块,其在运行状态时可以载入到web服务器,
或者作为静态模块,其可直接编译到web服务器代码中。对于文本,我们着重于第一种方式。
为了能让Apache2.0模块使php动态载入,Apache服务器必须以动态共享对象(DSO,Dynamic Shared Object)编译。
可以通过传递 --enable-so 参数到 Apache 2
tar -jxvf httpd-2.2.2.tar.bz2
cd httpd-2.2.2
./configure --prefix=/usr/local/apache2 --enable-so make && make install
//切记要支持Zend Optimizer不可加 --with-mpm=worker选项
这一过程将会设置,编译,以及将服务器安装到/usr/local/下。
启动apache守护进程:
/usr/local/apache2/bin/apachectl start (开启 start关闭 stop重启 restart)
打开浏览器,输入http://localhost 就能看到一个apache的欢迎页面了,这表示我们已经成功的安装了apache2 。
==============================================================================================================================================
安装 Mysql5
groupadd mysql
useradd -g mysql mysql

tar -zxvf mysql-5.0.17.tar.gz
cd mysql-5.0.17
./configure --prefix=/usr/local/mysql --enable-assembler--with-mysqld-ldflags=-all-static --with-extra-charsets=all
--with-big-tables --with-charset=utf8 --with-collation=utf8_unicode_ci
make
make install
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql/
bin/mysql_install_db --user=mysql
chown -R root .
chown -R mysql var
chgrp -R mysql .
启动服务:
/usr/local/mysql/share/mysql/mysql.server start(启动start 关闭stop  重启restart)
键入mysql回车就可已看到欢迎界面。说明我们已成功安装了mysql
说明: 
--with-extra-charsets=all 对多语言支持
--with-unix-socket-path=/usr/local/mysql/var/mysql.sock 这个是指定mysql服务启动后。联机套接字文件所处的位置和文件名,也就是说,如果mysql服务器成功启动后,就能在/usr/local/mysql/var.采用这一选项,通常会出错,建议不配置用默认的。默认会在/tmp/mysql.sock.
目录中看到mysql.sock文件。
==================================================================================
安装 php5
tar -zxvf php-5.1.6.tar.gz
cd php-5.1.6
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs
--with-config-file-path=/etc --with-libxml-dir=/usr/local/libxml2
--with-zlib-dir=/usr/local/zlib --with-curl=/usr/local/curl
--with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg6
--with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
--with-openssl --enable-gd-native-ttf --enable-mbstring --enable-ftp
--enable-bcmath --enable-sockets --enable-zip --enable-soap
--enable-calendar //切记要支持Zend Optimizer不可加 --enable-debug选项
make
make install
cp php.ini-dist /etc/php.ini
=============================================
整合apache2和php5
apache 配置文件及目录是:
/usr/local/apache2/conf/httpd.conf
apache 默认存放主页的位置是:
/usr/local/apache2/htdocs
以下是配置文件里面的信息:(有的地方要做修改)
ServerRoot "/usr/local/apache2"
这是指定apache程序所在的目录,比如日志文件、配置文件等目录。
DocumentRoot "/usr/local/apache2/htdocs"
这个是存放网页的目录
<Directory "/usr/local/apache2/htdocs">
这一句应该和DocumentRoot的目录保持一致。
找到 DirectoryIndex index.html
改为 DirectoryIndex index.html index.html.var index.htm index.php
找到 AddType application/x-gzip .gz .tgz
加 AddType application/x-httpd-php .php (注意空格)
AddType application/x-httpd-php-source .phps
添加 AddDefaultCharset utf8 使apache默认支持utf8字符集
保存配置文件就重启apache 的守护进程。
/usr/local/apache2/bin/apachectl restart

注意: 
每次更改配置文件。要重启服务。
对存放网页的目录执行:命令chmod 755 目录名 或者 chmod -R 755 目录名

编辑php.ini文件,找到
;default_charset="iso-8859-1"
增加一行:default_charset="utf8"

以上步骤都执行完后。在/usr/local/apache2/htdocs/里编辑文件进行测试。
phpinfo.php
里面的内容:
<?php
phpinfo();
?>
在浏览器地址栏中输入:
http://localhost/phpinfo.php
出现php说明页面说明安装成功。
安装过程相当简单,网上很多这种文档,整理的也很详细,我就不多废话了。就具体就在fedora6下碰到的问题说明一下: 接下:

接上

安装时的问题及解决方法

安装php5的过程中会自动在/usr/local/apache2/conf/httpd.conf里添加:
LoadModule php5_module modules/libphp5.so
重新启动apache报如下错误:
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
解决办法:
chcon /usr/local/apache/modules/libphp5.so -t shlib_t
原因是Linux有一个SELinux保护模式引起的。
关闭SELINUX的方法:
vi /etc/selinux/config 将SELINUX=enforcing 改成SELINUX=disabled
保存,重起电脑即可.
FC5 中的SELinux 代表了用户,程序以及进程间相互交流的主要变化。

=============================================
安装phpMyAdmin2.8.1
unzipphpMyAdmin2.8.1.zip
cp-r phpMyAdmin2.8.1 /usr/local/apache2/htdocs
cd /usr/local/apache2/htdocs/phpMyAdmin2.8.1/libraries
cp config.default.php ../config.inc.php
gedit config.inc.php
找到$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?一行(大概在71行)将值改为http 或 cookie,随自己喜欢
==================================================================================
安装Zend optimizer3.2.8
这可能是最简单也是最容易出问题的地方(我在此吃尽苦头)
tar -zxvf ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.2.8-linux-glibc21-i386
./install
安装完后重启apache,在phpinfo.php的欢迎页面第二个域你会看到:
---------------------------------------------------------------------------------------------------------------------------------------------------
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.2.8, Copyright (c) 1998-2007, by Zend Technologies
Zend logo

执行 /usr/local/php5/bin/php -v应该看到:
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.2.8, Copyright (c) 1998-2007, by Zend Technologies

否则就是安张出问题了。可能是编译apache画蛇添足添加了--with-mpm=worker 没有用默认的prefork模块
另一中可能就是编译php是加入了--enable-debug
zend optimizer 需要apache(perfork only) php(no debugMod)这些在Zend optimizer User`Gurde上有说明需特别注意了
over
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics