posts - 325,  comments - 25,  trackbacks - 0

          一、安裝相關依賴庫

              yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers pcre pcre-devel

          二、解壓php包

          tar -zxvf php-5.6.3.tar.gz

          cd php-5.6.3

          export LD_LIBRARY_PATH=/usr/local/libgd/lib

          三、編譯安裝

          ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysql-sock=/usr/local/mysql/mysql.sock  --with-apxs2=/usr/local/apache/bin/apxs --with-gd --with-jpeg-dir --with-png-dir --enable-mbstring --enable-xml --enable-fpm --with-freetype-dir --with-mcrypt --with-mhash --with-libxml-dir --with-zlib-dir

          make

          make install

          四、配置php

          cp php.ini-production /usr/local/php/etc/php.ini #復制php配置文件到安裝目錄

          ln -s /usr/local/php/etc/php.ini /etc/php.ini #添加軟鏈接到 /etc目錄
          rm -rf /etc/php.ini #刪除系統(tǒng)自帶配置文件

          vi /etc/php.ini

          找到:disable_functions =

          修改為:disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname

          #列出PHP可以禁用的函數(shù),如果某些程序需要用到這個函數(shù),可以刪除,取消禁用。

          找到:;date.timezone =

          修改為:date.timezone = PRC #設置時區(qū)

          找到:expose_php = On

          修改為:expose_php = Off #禁止顯示php版本的信息

          找到:short_open_tag = Off

          修改為:short_open_tag = ON #支持php短標簽

          :wq! 保存

           

           

          cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf #拷貝模板文件為php-fpm配置文件

          ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf #添加軟連接到 /etc目錄

          vi /usr/local/php/etc/php-fpm.conf #編輯

          user = www #設置php-fpm運行賬號為www

          group = www #設置php-fpm運行組為www

          pid = run/php-fpm.pid #取消前面的分號

          :wq! #保存退出

           

          cp /home/php-5.6.3/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷貝php-fpm到啟動目錄
          chmod +x /etc/rc.d/init.d/php-fpm #添加執(zhí)行權限
          chkconfig php-fpm on #設置開機啟動

          編輯apache配置文件httpd.conf,以apache支持php
          # vim /etc/httpd/httpd.conf
          添加如下

           

           AddType application/x-httpd-php .php .phtml
          定位至DirectoryIndex index.html
           
          修改為:
          DirectoryIndex index.php index.html
          添加index.php為默認主頁

          重新啟動apache

          五、測試

          在/usr/local/apache/htdocs目錄下建一個test.php或test.phtml的文件,內(nèi)容如下示:

          <</FONT>

          ?

          php

          phpinfo();

          ?

          >

          :wq! #保存退出

          posted on 2016-03-10 15:38 長春語林科技 閱讀(146) 評論(0)  編輯  收藏 所屬分類: linux
          <2016年3月>
          282912345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 德格县| 资中县| 大宁县| 玉林市| 鄄城县| 桃园县| 老河口市| 麻江县| 彭州市| 焦作市| 龙游县| 乡宁县| 云龙县| 苏尼特右旗| 左权县| 栖霞市| 南木林县| 南召县| 翼城县| 邹平县| 定西市| 若羌县| 临汾市| 望都县| 建瓯市| 余姚市| 平远县| 九龙坡区| 江达县| 永宁县| 上思县| 武陟县| 闵行区| 碌曲县| 织金县| 长垣县| 伊金霍洛旗| 鱼台县| 五原县| 安岳县| 昌黎县|