参考:http://bbs.linuxpk.com/thread-28882-1-1.html
apache+php安装:
yahoo内部有其专门的apache和php,分别为yapache和yphp
这里是不是用的雅虎的,而是直接从网上下的
按照上面网站上给出的说明,
只安装了其中的三个部分,apache,php,libxml
按安装顺序:
httpd
简要步骤如下,#号提示符后面为命令,复制所有软件包到一个位置,我这里是在/usr/local/src目录下创建lamp目录,然后复制所有软件包到lamp下
#cd /usr/local/src/lamp
#tar zxvf httpd-2.2.8.tar.bz2
#cd http-2.2.8
#./configure --prefix=/usr/local/apache2 --enable-rule=SHARED_CORE --enable-module=so
#make
#make install
安装apache完成,输入命令
#/usr/local/apache2/bin/apachectl -k start
从本地或其它机器打开Firefox浏览器(我的钟爱),输入地址http://你的服务器ip地址,记得开放服务器的80端口,不然可能会提示错误,如果正确的话会出现一个"It works !"的提示页面,此时,apache2基本安装完成。
libxml2的安装
#tar zxvf libxml2-2.6.31.tar.gz
#cd libxml2
#./configure --prefix=/usr/local/libxml2
(可以尝试打开zlib开关,--with-zlib)
#make(时间可能稍微长些)
#make install
#cp xml2-config /usr/bin
PHP5的安装
#tar zxvf php-5.2.5.tar.bz2
#cd php
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs /
--enable-track-vars --with-sockets --enable-sockets --with-sysvshm --with-sysvsem /
--with-pdflib-dir=/usr/local/lib --with-jpeg-dir=/usr/local/jpeg /
--with-png-dir=/usr/local/lib --with-zlib-dir=/usr/local/lib /
--with-freetype-dir=/usr/local/freetype --with-curl=/usr/local/curl /
--with-libxml-dir=/usr/locallibxml2/lib --with-t1lib=/usr/localt1lib /
--with-gettext=/usr/localgettext/lib --with-gd --with-mysql
(最好加上mbstring 和 mcypt ,不知道是不是必须)
configure后如果成功会提示PHP欢迎界面: Thank you for using PHP.
#make
#make test
(大约3000多项测试吧)
# make install
Php.ini文件的修改
#cp php.ini.dist /usr/local/lib/
查找修改extension_dir='./'的内容
extension_dir = /usr/local/lib
extension=libpdf_php.so
保存退出
最后修改apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
查找AddType 大约在DefaultType text/plain
<IfModule mime_module>
输入如下内容
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
(不清楚是不是必须输入这么多项)
查找DirectoryIndex index.html 在其后输入 index.php
保存文件,退出。
测试php,创建info.php文件放到网站的目录下,我这里是/usr/local/apapche2/htdocs
内容如下
<?PHP
echo phpinfo();
?>
重新启动apache服务,从本机或其它机器测试
输入http;//ip地址/info.php
如果你可以看到php配置信息的输出,那php的基本安装可以了。
php apache 安装配置
最新推荐文章于 2025-08-10 20:41:29 发布