一、安裝

yum install -y php php-suhosin php-gd php-pdo php-bcmath php-cli php-comon php-dba php-devel php-Monolog php-mbstring php-imap php-mysql php-process php-snmp php-xml php-mcrypt php-tidy php-pear php-pecl-apc php-pecl-memcache php-pecl-memcached phpMyAdmin php-intl

常見php套件

套件名稱 套件說明
php-5.3.3-23.el6_4.x86_64  
php-gd.x86_64 A module for PHP applications for using the gd graphics library
php-suhosin.x86_64 Suhosin is an advanced protection system for PHP installations
php-pdo.x86_64 A database access abstraction module for PHP applications
php-bcmath.x86_64 A module for PHP applications for using the bcmath library
php-cli.x86_64 Command-line interface for PHP
php-common.x86_64 Common files for PHP
php-dba.x86_64 A database abstraction layer module for PHP applications
php-devel.x86_64 Files needed for building PHP extensions
php-Assetic.noarch Asset Management for PHP
php-Monolog.noarch Sends your logs to files, sockets, inboxes, databases and various web services
php-email-address-validation.noarch A PHP class for validating email addresses
php-embedded.x86_64 PHP library for embedding in applications
php-enchant.x86_64 Human Language and Character Encoding Support
php-fpm.x86_64 PHP FastCGI Process Manager
php-imap.x86_64 A module for PHP applications that use IMAP
php-intl.x86_64 Internationalization extension for PHP applications
php-mbstring.x86_64 A module for PHP applications which need multi-byte string handling
php-mysql.x86_64 A module for PHP applications that use MySQL databases
php-ldap.x86_64 A module for PHP applications that use LDAP
php-process.x86_64 Modules for PHP script using system process interfaces
php-pspell.x86_64 A module for PHP applications for using pspell interfaces
php-recode.x86_64 A module for PHP applications for using the recode library
php-redland.x86_64 HP modules for the Redland RDF library
php-snmp.x86_64 A module for PHP applications that query SNMP-managed devices
php-tidy.x86_64 Standard PHP module provides tidy library support
php-xml.x86_64 A module for PHP applications which use XML
php-pear.noarch PHP Extension and Application Repository framework
php-mcrypt.x86_64 Standard PHP module provides mcrypt library support
php-mssql.x86_64 Standard PHP module provides mssql support
php-pecl-apc.x86_64 APC caches and optimizes PHP intermediate code
php-pecl-memcache.x86_64 xtension to work with the Memcached caching daemon
php-pecl-memcached.x86_64 Extension to work with the Memcached caching daemon
phpMyAdmin.noarch  Handle the administration of MySQL over the World Wide Web
php-intl.x86_64  Internationalization extension for PHP applications
   


二、設定/etc/php.ini
       1.修改使用網頁上傳檔案的上限 預設是2M
           upload_max_filesize = 100M
       2.網頁post資料時 php可接受的大小 預設為8M
           因為還有其他資料需傳送,切記需設定大於upload_max_filesize
           post_max_size =200M
       3.設定時區為亞洲/台北
          date.timezone = Asia/Taipei

       4.更改執行語法的記憶體上限

         ; Maximum amount of memory a script may consume (128MB)
         ; http://www.php.net/manual/en/ini.core.php#ini.memory-limit
         memory_limit = 256M
       5.重啟動apache
          service httpd restart
       6.檢查php設定
          新增 /var/www/html/info.php
          檔案內容為

         <?php
          phpinfo();
         ?>

    6.開啟瀏覽器執行 http://localhost/info.php

    7.再檢查是否有其他錯誤

      執行 php -v 產生如下訊息

     [root@dns modules]# php -v
     PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/module.so' - /usr/lib64/php/modules    /module.so: cannot open shared object file: No such file or directory in Unknown on line 0
    PHP 5.3.3 (cli) (built: Jul 12 2013 20:35:47)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH

   module.so套件是php-mcrypt所使用,開啟/etc/php.d/mcrypt.ini其訊息如下:

   ; Enable mcrypt extension module
   extension=module.so

   檢查/usr/lib64/php/modules中並無module.so,但有mcrypt.so

   將extension=module.so 改為extension=mcrypt.so

   再執行php -v 檢查後顯示訊息如下:

   [root@dns modules]# php -v
    PHP 5.3.3 (cli) (built: Jul 12 2013 20:35:47)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH

    再重新啟動apache

   service httpd restart

 

三、設定phpMyAdmin

     1.開啟/etc/httpd/conf.d/phpMyAdmin.conf檔案

         得知phpMyAdmin檔案位於

        /usr/share/phpMyAdmin

     2.建立phpMyAdmin設定檔

        複製範本設定檔 config.sample.inc.php 並重新命名為 config.inc.php

        cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php

     3.設定驗證模式

        編輯/usr/share/phpMyAdmin/config.inc.php

        找到

        /* Authentication type */
        $cfg['Servers'][$i]['auth_type'] = 'cookie';

        改為

        /* Authentication type */
        $cfg['Servers'][$i]['auth_type'] = 'http';

      4.重啟動apache

         service httpd restart

  5.測試phpMyAdmin

     開啟瀏覽器執行  http://localhost/phpMyAdmin 以mySQL最大權限 root帳號登入

四、設定php-suhosin 

       1.編輯設定檔 /etc/php.d/conf.d/suhosin.ini

           phpmyAdmin 建議值

           The default values for most Suhosin configuration options will work in most scenarios, however you might want to adjust at least following parameters:

        找到上列清單設定值,移除註記照範例修改其設定值

        其他設定值

       ; Defines the maximum length of array indices for variables registered through
       ; the URL
       suhosin.get.max_array_index_length = 256

      ; Defines the maximum name length (excluding possible array indicies) of
      ; variables that may be registered through the COOKIE, the URL or through a
      ; POST request. This setting is also an upper limit for the variable origin
      ; specific configuration directives.
      suhosin.request.max_varname_length = 256

      ; Defines the maximum number of variables that may be registered through the
      ; COOKIE.
      suhosin.cookie.max_vars = 2048

 

 

,

K 發表在 痞客邦 PIXNET 留言(0) 人氣()