lamp 中 php的安装

同事安装的apache 和mysql,但是php没有安装成功

apache 目录:/usr/local/apache2/

mysql目录:/var/lib/mysql

php 要安装的目录:/usr/local/php

问题1:安装php(未结合mysql)时出现如下错误:

          Installing PHP SAPI module:       apache2handler
          /usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' libphp5.la /usr/local/apache2/modules
          /usr/local/apache2/build/libtool --mode=install cp libphp5.la /usr/local/apache2/modules/
          cp .libs/libphp5.so /usr/local/apache2/modules/libphp5.so
          cp .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la
          libtool: install: warning: remember to run `libtool --finish /usr/php-5.5.7/libs'
          chmod 755 /usr/local/apache2/modules/libphp5.so
          apxs:Error: Activation failed for custom /usr/local/apache2/conf/httpd.conf file..
          apxs:Error: At least one `LoadModule' directive already has to exist..
          make: *** [install-sapi] Error 1

      解决方法:

                  1. vi  /usr/local/apache2/conf/httpd.conf,

                  2.添加如下:

                         LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

                         因为在/usr/local/apache2/modules/只有一个后缀.so的文件

 

                 3,重启apache即可

 

      问题2,上述安装成功后,发现并没有对php和Mysql进行整合

                于是重新安装

               安装语句:

                  ./configure --prefix=/usr/local/php --enable-mbstring --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/var/lib/mysql --with-config-file-path=/usr/local/php

                 发现不行,报错:configure: error: Cannot find MySQL header files under /var/lib/mysql.

                 后来百度,发现可以这样写:

                      ./configure --prefix=/usr/local/php --enable-mbstring --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql  --with-config-file-path=/usr/local/php

                     然后 make ,make install  发现成功了

       

posted @ 2013-12-30 09:26  longwaylongpurpose  阅读(488)  评论(0编辑  收藏  举报