SUSE Linux下源码编译安装apache2.2.6+php5.1.16+mysq(3)

# tar zxvf php-5.1.16.tar.gz

# cd php-5.1.16

#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-pear=/usr/share/php --with-zlib-dir --with-bz2 --with-libxml-dir=/usr --with-gd=/usr/local/gd2 --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf=shared,/usr --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/etc --with-iconv --disable-ipv6 --enable-static --enable-maintainer-zts --enable-zend-multibyte --enable-inline-optimization --enable-zend-multibyte --enable-sockets --enable-soap

配置成功会提示:

+--------------------------------------------------------------------+

| License: |

| This software is subject to the PHP License, available in this |

| distribution in the file LICENSE. By continuing this installation |

| process, you are bound by the terms of this license agreement. |

| If you do not agree with the terms of this license, you must abort |

| the installation process at this point. |

+--------------------------------------------------------------------+

Thank you for using PHP.

# make

# make install

# cp php.ini-recommended /etc/php.ini

四 、整合apache 与php

# vi /usr/local/apache2/conf/httpd.conf

在最后一行加上:

AddType application/x-httpd-php .php

查找:(设置 WEB 默认文件)

DirectoryIndex index.html

替换为:

DirectoryIndex index.php index.html index.htm //在 WEB 目录不到默认文件,httpd 就会执行 /var/www/error/noindex.html

找到这一段:

# AllowOverride controls what directives may be placed in .htaccess files.

# It can be "All", "None", or any combination of the keywords:

# Options FileInfo AuthConfig Limit

#

AllowOverride none

更改为AllowOverride all

允许apache rewrite

保存httpd.conf,退出。

# /usr/local/apache2/bin/apachectl restart //重启 Apache

五、 测试

vi /usr/local/apache2/htdocs/test.php

新增加下面一行,并保存。

<?php phpinfo(); ?>

# chmod 755 /usr/local/apache2/htdocs/phpinfo.php

用浏览器打开

或者  本机ip/test.php

(如ip为192.168.1.2 则  )

当看到php页面时表示成功!

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

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