作者:[email protected]
博客:yuweixian4230.blog.chinaunix.net
php : hypertext prorocessor 超文本预处理程序
ubuntu10.10 源码安装apache php
1. 下载源码
apache download
http://httpd.apache.org/download.cgi
php download
http://php.net/downloads.php
2. 参考安装文档
http://fengzheng369.blog.163.com/blog/static/75220979201092883119968/
3. 安装apache
- root@ywx:/home/ywx/yu/apache/httpd-2.2.19# ./configure --prefix=/usr/local/apache --enable-so
- root@ywx:/home/ywx/yu/apache/httpd-2.2.19# make
- root@ywx:/home/ywx/yu/apache/httpd-2.2.19# make install
4. 安装php
- root@ywx:/home/ywx/yu/apache/php-5.3.7# apt-get install libxml2-dev
- root@ywx:/home/ywx/yu/apache/php-5.3.7# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs
- root@ywx:/home/ywx/yu/apache/php-5.3.7# make;make install
- root@ywx:/home/ywx/yu/apache/php-5.3.7# cp php.ini-development /usr/local/lib/php.ini
5. 配置文件
- root@ywx:/usr/local/apache/conf# gedit httpd.conf
- 找到AddType的那节,在下面加上:
- AddType application/x-httpd-php .php .phtml .php3 ##注意空格
Addtype application/x-httpd-php-source .phps - LoadModule php5_module modules/libphp5.so
6. 运行apache
- root@ywx:/usr/local/apache/bin# ./apachectl start
- httpd (pid 25721) already running
- root@ywx:/usr/local/apache/bin# ./apachectl restart
- root@ywx:/usr/local/apache/bin# ./apachectl stop
- root@ywx:/usr/local/apache/bin# ./apachectl start
- root@ywx:/usr/local/apache/bin# ./apachectl start
- httpd (pid 25774) already running
- root@ywx:/usr/local/apache/bin#
7. 测试
启动apache
root@ywx:/home/ywx/yu# /usr/local/apache/bin/apachectl start
或
root@ywx:/home/ywx/yu# /usr/local/apache/bin/httpd -k start
vim test.php
- <?php
- phpinfo();
- ?>
将 test.php 复制到 /usr/local/apache/htdocs/ 下
chmod u+x test.php
打开浏览器访问