Ubuntu下安装LAMP环境最简单的方法(3)

在 PHP 4.x 版的方法大致和 PHP 3.0.x 版相同,不同的地方在于 PHP 4.x 的目录名称及编译后的模块放置目录不同。此外,默认的扩展名也由 .php3 变成了 .php。当然在安装前还要先下载 PHP 4.x 的程序才行。

gzip -dc apache_1.3.x.tar.gz | tar xvf -
gzip -dc php-4.0.x.tar.gz | tar xvf -
cd apache_1.3.x
./configure --prefix=/www
cd ../php-4.0.x
./configure --with-MySQL --with-apache=../apache_1.3.x --enable-track-vars
make
make install
cd ../apache_1.3.x
./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
make
make install
cd ../php-4.0.x
cp php.ini-dist /usr/local/lib/php.ini
在 httpd.conf 或 srm.conf 加入

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

而 PHP 4.x 版中对 Apache 服务器加入了新的环境变量配置项。

php_value [PHP directive name] [value]
php_flag [PHP directive name] [On|Off]
php_admin_value [PHP directive name] [value]
php_admin_flag [PHP directive name] [On|Off]

在 PHP 3.0.x 版中,有些目录可能会有 .htaccess 的文件,使用 PHP 4.0.x 版的系统,必须将这个文件拿掉,可以使用改名字的方式或者直接删除。

------------------------------------

当一切配置好了之后,重新执行 Apache 服务器。在 Apache 目录下有 bin 或是 sbin 的目录,其中会有 apachectl 的 shell 程序,输入 apachectl restart 就可以重新启动 Apache 服务器了。

赶快试看看 hello, world 程序吧!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyfyyg.html