linux 学习笔记 - php 环境安装与配置
2006-04-10 11:11
1566 查看
摘自:http://www.isswhu.cn/forums/viewthread.php?tid=11
http://article.21e.cn/view.php?pid=279
linux下安装最新apache2.0.52+php5+gd2+mysql
安装前的准备工作:
安装 bzip2-1.0.2.tar.gz
安装 freetype-2.1.9.tar.bz2 使 php 更好的支持字体
安装 gd-2.0.26gif.tar.gz 为 php 提供图像函数库
安装 jpegsrc.v6b.tar.gz 使 php 支持 jpeg
安装 libpng-1.2.8.tar.bz2 使 php 支持 png
安装 libxml2-2.6.16.tar.gz 使 php 支持 xml
安装 zlib-1.2.1.tar.bz2
各种文件下载地址或参考网站:
bzip2-1.0.2.tar.gz
http://www.digistar.com/bzip2/
freetype-2.1.9.tar.bz2
http://freetype.sourceforge.net/index2.html
gd-2.0.26gif.tar.gz & gd-2.0.26.tar.gz
http://www.rime.com.au/gd/
jpegsrc.v6b.tar.gz
ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
libpng-1.2.8.tar.bz2
http://www.libpng.org/pub/png/libpng.html
libxml2-2.6.16.tar.gz
http://xmlsoft.org/downloads.html
zlib-1.2.1.tar.bz2
http://www.gzip.org/zlib/
可以用gcc -v来查看是否安装了GCC,
#gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
安装XPM (我在安装过程中没碰到这个东东。。。。)
#rpm -ivhxpm-3.4k-2.i386.rpm
安装php5,一般要带上下面的参数:
# ./configure --prefix=/server/php --with-apxs2=/server/apache/bin/apxs --with-mysql=/server/mysql --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-ttf=/usr/local --with-freetype-dir=/usr/local --with-tiff-dir=/usr/local --with-zlib-dir=/usr/local --enable-gd-native-ttf --with-gzip --with-bz2 --with-dom --enable-exif --enable-ftp --with-iconv --with-kerberos --with-java=/usr/java/j2sdk1.4.1_01 --enable-mbstring=all --enable-mbregex --with-mime-magic --with-pdflib --enable-sockets --enable-wddx --with-expat-dir=/usr/local
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini //复制PHP.INI文件到正确位置
编辑apache配置文件httpd.conf #vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
一般都在
#AddType application/x-tar .tgz
下加一行
#LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
如果你搜索其它地方没有以下这行
LoadModule php5_module modules/libphp5.so
请把上面的#号去掉
还有找到
DirectoryIndex index.html index.html.var
在后面加 index.php 让它把index.php做为默认页
找到
# don't use Group #-1 on these systems!
把下面的用户名和组改为
User apache
Group apache
(原来好像是nobody)
再找
#ServerName
把#去掉,后面的IP改成你的IP.
找到
DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改为你存放网页文件的路径
为了让中文网页没乱码
找到
AddDefaultCharset iso8859-1
把后面的iso8859-1改为gb2312 或者是干脆off
其他的选项就自己修改吧!或者到http://article.21e.cn 有一个专门的httpd.conf的说明!
保存httpd.conf文件.
启动apache
# /usr/local/apache2/bin/apachectl start
如果没有出错,写一个测试页放到你网页目录下.访问就应该可以看到php的版本等信息了!
如无意外.PHP脚本已经可以连接mysql了.
用ZendOptimizer加速PHP
#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh
安装的经验:
注意仔细阅读 README INSTALL 或其他帮助类文档
./configure --help 查看配置选项
在 make 后,make install 之前可能有 make test 或 make check 用来试安装
如果想重新配置安装,需要尝试清除 .cache 的缓存文件和运行 make clean 等
可能会有 config.guess, config.status 或 config.nice 之类的文件来查看先前的配置,默认配置,或。。。
http://article.21e.cn/view.php?pid=279
linux下安装最新apache2.0.52+php5+gd2+mysql
安装前的准备工作:
安装 bzip2-1.0.2.tar.gz
安装 freetype-2.1.9.tar.bz2 使 php 更好的支持字体
安装 gd-2.0.26gif.tar.gz 为 php 提供图像函数库
安装 jpegsrc.v6b.tar.gz 使 php 支持 jpeg
安装 libpng-1.2.8.tar.bz2 使 php 支持 png
安装 libxml2-2.6.16.tar.gz 使 php 支持 xml
安装 zlib-1.2.1.tar.bz2
各种文件下载地址或参考网站:
bzip2-1.0.2.tar.gz
http://www.digistar.com/bzip2/
freetype-2.1.9.tar.bz2
http://freetype.sourceforge.net/index2.html
gd-2.0.26gif.tar.gz & gd-2.0.26.tar.gz
http://www.rime.com.au/gd/
jpegsrc.v6b.tar.gz
ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
libpng-1.2.8.tar.bz2
http://www.libpng.org/pub/png/libpng.html
libxml2-2.6.16.tar.gz
http://xmlsoft.org/downloads.html
zlib-1.2.1.tar.bz2
http://www.gzip.org/zlib/
可以用gcc -v来查看是否安装了GCC,
#gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-34)
安装XPM (我在安装过程中没碰到这个东东。。。。)
#rpm -ivhxpm-3.4k-2.i386.rpm
安装php5,一般要带上下面的参数:
# ./configure --prefix=/server/php --with-apxs2=/server/apache/bin/apxs --with-mysql=/server/mysql --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-ttf=/usr/local --with-freetype-dir=/usr/local --with-tiff-dir=/usr/local --with-zlib-dir=/usr/local --enable-gd-native-ttf --with-gzip --with-bz2 --with-dom --enable-exif --enable-ftp --with-iconv --with-kerberos --with-java=/usr/java/j2sdk1.4.1_01 --enable-mbstring=all --enable-mbregex --with-mime-magic --with-pdflib --enable-sockets --enable-wddx --with-expat-dir=/usr/local
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini //复制PHP.INI文件到正确位置
编辑apache配置文件httpd.conf #vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
一般都在
#AddType application/x-tar .tgz
下加一行
#LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
如果你搜索其它地方没有以下这行
LoadModule php5_module modules/libphp5.so
请把上面的#号去掉
还有找到
DirectoryIndex index.html index.html.var
在后面加 index.php 让它把index.php做为默认页
找到
# don't use Group #-1 on these systems!
把下面的用户名和组改为
User apache
Group apache
(原来好像是nobody)
再找
#ServerName
把#去掉,后面的IP改成你的IP.
找到
DocumentRoot "/usr/local/apache2/htdocs"
把/usr/local/apache2/htdocs改为你存放网页文件的路径
为了让中文网页没乱码
找到
AddDefaultCharset iso8859-1
把后面的iso8859-1改为gb2312 或者是干脆off
其他的选项就自己修改吧!或者到http://article.21e.cn 有一个专门的httpd.conf的说明!
保存httpd.conf文件.
启动apache
# /usr/local/apache2/bin/apachectl start
如果没有出错,写一个测试页放到你网页目录下.访问就应该可以看到php的版本等信息了!
如无意外.PHP脚本已经可以连接mysql了.
用ZendOptimizer加速PHP
#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh
安装的经验:
注意仔细阅读 README INSTALL 或其他帮助类文档
./configure --help 查看配置选项
在 make 后,make install 之前可能有 make test 或 make check 用来试安装
如果想重新配置安装,需要尝试清除 .cache 的缓存文件和运行 make clean 等
可能会有 config.guess, config.status 或 config.nice 之类的文件来查看先前的配置,默认配置,或。。。
相关文章推荐
- Linux+Apache+PHP+MYSQL环境配置学习笔记
- PHP学习笔记----IIS7下安装配置php环境
- PHP学习笔记 IIS7下安装配置php环境
- PHP学习笔记----IIS7下安装配置php环境
- PHP学习笔记 IIS7下安装配置php环境
- Linux下安装php环境并且配置Nginx支持php-fpm模块
- 在Linux上安装Gearman及配置使用Gearman的PHP扩展环境
- mongoDB 学习笔记 — Linux下的安装和配置
- MySQL学习笔记之一:安装与配置(Windows 7环境)
- 学习笔记1——Linux(CentOS)在虚拟机上最小化安装之后的网络配置及其与主机的连接
- OPENCV学习笔记(一):安装OpenCV:OpenCV 3.0、OpenCV 2.4.8、OpenCV 2.4.9 +VS 开发环境配置
- Liferay 6.2学习笔记(一)--开发环境安装配置
- 【Python学习笔记】Linux环境下virtualenv安装和使用
- linux,安装并配置PHP环境
- LAMP攻略: LAMP环境搭建,Linux下Apache,MySQL,PHP安装与配置
- Linux下安装、配置PHP环境
- 【学习笔记】 linux中安装配置java
- Nginx学习笔记——搭建Linux +Nginx+PHP+Mariadb(MySql)开发环境
- Linux下 php环境安装、配置composer,使用composer安装laravel、zan等框架
- [Linux][VMWare] 学习笔记之安装Linux系统-网络配置