温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

手动编译PHP

发布时间:2020-08-02 15:49:12 来源:网络 阅读:473 作者:monkeyC 栏目:web开发

如何将php安装位apache的模块



  1. 获取安装文件: http://www.php.net/downloads.php  php-5.3.8.tar.gz

  2. tar xf php-5.4.13 -C /usr/local

  3. cd /usr/local/php-5.4.13

  4. ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-config-file-path=/etc/ --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts(最后一项如果是per类型不用加 如果是work或者event就加 httpd -M 可以查看)

   注意:要想使用--with-mcrypt加密功能需要安装四个包:

                    mhash-0.9.2-6.el5.i386.rpm

                    mhash-devel-0.9.2-6.el5.i386.rpm 

                    libmcrypt-2.5.7-5...

                    libmcrypt-devel....

     注意:rpmfind.net  可以下载各种rpm包   rpm -ivh *.rpm就可以安装

     注意:将:--with-apxs2=/usr/local/apache2/bin/apxs改为--enable-fpm 表示启用fpm功能

                  即fastcgi格式

5.cd /usr/local/php...  

  cp php.ini-production 服务器端 /etc/php.ini

6.找到httpd的配置文件   找到AddType 添加两行

                AddType application/x-httpd-php .php

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

7.再找到DirectoryIndex目录主页面 

                改为DirectoryIndex index.php index.html

8../apachectl -f /usr/local/apache2/conf/httpd.conf -k start 启动起来     

9.cd /usr/local/apache2/htdocs    mv index.html index.php

10.vim index.php

        <?php

           $conn=mysql_connect('localhost','root','');

           if ($conn)

                echo "Success...";

           else

                echo "Failure...";   

            ?>

service iptables stop

测试成功

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI