Install & Configure PHP

Installation

If not included as part of the initial Linux installation, install the following PHP RPM packages and any dependencies listed by yum:

  • php
  • php-cli
  • php-common
  • php-devel
  • php-gd
  • php-mbstring
  • php-mysql
  • php-pear
  • php-pdo

Post-Install

Additionally the following PEAR (PHP Extension and Application Repository) modules must be installed. A few will already be installed via RPM, some will need updating/installing via pear:

  • Archive_Tar 1.3.11
  • Console_Getopt 1.3.1
  • HTML_Common 1.2.5
  • HTML_QuickForm 3.2.13
  • HTTP 1.4.1
  • HTTP_Download 1.1.4
  • HTTP_Header 1.2.1
  • PEAR 1.9.4
  • Structures_Graph 1.0.4
  • XML_RPC 1.5.5
  • XML_Util 1.2.1

To install & upgrade required PEAR modules, use the following procedure:

  • List installed PEAR modules:
    • [root@demo ~]# pear list
      Installed packages, channel pear.php.net:
      =========================================
      Package        Version State
      Archive_Tar    1.3.1   stable
      Console_Getopt 1.2     stable
      PEAR           1.4.9   stable
      XML_RPC        1.5.0   stable
  • Check for upgrades:
    • [root@demo ~]# pear list-upgrades
      WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update
      pear.php.net Available Upgrades (stable):
      =========================================
      Channel      Package        Local          Remote          Size
      pear.php.net Archive_Tar    1.3.1 (stable) 1.3.11 (stable) 18.1kB
      pear.php.net Console_Getopt 1.2 (stable)   1.3.1 (stable)  4.4kB
      pear.php.net PEAR           1.4.9 (stable) 1.9.4 (stable)  290kB
      pear.php.net XML_RPC        1.5.0 (stable) 1.5.5 (stable)  32kB
  • Per the warning, update the channel:
    • [root@demo ~]# pear channel-update pear.php.net
      Retrieving channel.xml from remote server
      Update of Channel "pear.php.net" succeeded
  • Upgrade pear itself. The '–force' switch is necessary to ensure pear is upgraded:
    • [root@demo ~]# pear upgrade --force pear
      warning: pear/PEAR dependency package "pear/Console_Getopt" downloaded version 1.3.1 is not the recommended version 1.2.3
      warning: pear/Archive_Tar requires PEAR Installer (version >= 1.5.4), installed version is 1.4.9
      warning: pear/Console_Getopt requires PEAR Installer (version >= 1.8.0), installed version is 1.4.9
      downloading PEAR-1.9.4.tgz ...
      Starting to download PEAR-1.9.4.tgz (296,332 bytes)
      .............................................................done: 296,332 bytes
      downloading Archive_Tar-1.3.11.tgz ...
      Starting to download Archive_Tar-1.3.11.tgz (18,537 bytes)
      ...done: 18,537 bytes
      downloading Structures_Graph-1.0.4.tgz ...
      Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
      ...done: 30,318 bytes
      downloading Console_Getopt-1.3.1.tgz ...
      Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes)
      ...done: 4,471 bytes
      downloading XML_Util-1.2.1.tgz ...
      Starting to download XML_Util-1.2.1.tgz (17,729 bytes)
      ...done: 17,729 bytes
      upgrade ok: channel://pear.php.net/XML_Util-1.2.1
      upgrade ok: channel://pear.php.net/Console_Getopt-1.3.1
      upgrade ok: channel://pear.php.net/Structures_Graph-1.0.4
      upgrade ok: channel://pear.php.net/Archive_Tar-1.3.11
      upgrade ok: channel://pear.php.net/PEAR-1.9.4
      PEAR: Optional feature webinstaller available (PEAR's web-based installer)
      PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
      PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
      To install use "pear install pear/PEAR#featurename"
  • Upgrade any remaining modules:
    • [root@demo ~]# pear upgrade-all
      Will upgrade channel://pear.php.net/xml_rpc
      WARNING: "pear/XML_RPC" is deprecated in favor of "pear/XML_RPC2"
      downloading XML_RPC-1.5.5.tgz ...
      Starting to download XML_RPC-1.5.5.tgz (31,862 bytes)
      .........done: 31,862 bytes
      upgrade-all ok: channel://pear.php.net/XML_RPC-1.5.5
  • Install the remaining modules:
    • [root@demo ~]# pear install HTML_Common HTML_QuickForm HTTP HTTP_Download HTTP_Header
      WARNING: "pear/HTML_Common" is deprecated in favor of "pear/HTML_Common2"
      WARNING: "pear/HTML_QuickForm" is deprecated in favor of "pear/HTML_QuickForm2"
      WARNING: "pear/HTTP" is deprecated in favor of "pear/HTTP2"
      Did not download optional dependencies: pear/Archive_Zip, pear/MIME_Type, use --alldeps to download automatically
      pear/HTTP_Download can optionally use package "pear/Archive_Zip"
      pear/HTTP_Download can optionally use package "pear/MIME_Type"
      pear/HTTP_Download can optionally use PHP extension "pgsql"
      downloading HTML_Common-1.2.5.tgz ...
      Starting to download HTML_Common-1.2.5.tgz (4,585 bytes)
      .....done: 4,585 bytes
      downloading HTML_QuickForm-3.2.13.tgz ...
      Starting to download HTML_QuickForm-3.2.13.tgz (103,483 bytes)
      ...done: 103,483 bytes
      downloading HTTP-1.4.1.tgz ...
      Starting to download HTTP-1.4.1.tgz (8,635 bytes)
      ...done: 8,635 bytes
      downloading HTTP_Download-1.1.4.tgz ...
      Starting to download HTTP_Download-1.1.4.tgz (14,571 bytes)
      ...done: 14,571 bytes
      downloading HTTP_Header-1.2.1.tgz ...
      Starting to download HTTP_Header-1.2.1.tgz (10,682 bytes)
      ...done: 10,682 bytes
      install ok: channel://pear.php.net/HTML_Common-1.2.5
      install ok: channel://pear.php.net/HTTP-1.4.1
      install ok: channel://pear.php.net/HTML_QuickForm-3.2.13
      install ok: channel://pear.php.net/HTTP_Header-1.2.1
      install ok: channel://pear.php.net/HTTP_Download-1.1.4
  • List & verify installed modules:
    • [root@demo ~]# pear list
      Installed packages, channel pear.php.net:
      =========================================
      Package          Version State
      Archive_Tar      1.3.11  stable
      Console_Getopt   1.3.1   stable
      HTML_Common      1.2.5   stable
      HTML_QuickForm   3.2.13  stable
      HTTP             1.4.1   stable
      HTTP_Download    1.1.4   stable
      HTTP_Header      1.2.1   stable
      PEAR             1.9.4   stable
      Structures_Graph 1.0.4   stable
      XML_RPC          1.5.5   stable
      XML_Util         1.2.1   stable

IMPORTANT: Ignore the warnings about deprecated versions of HTML_Common, HTML_QuickForm & HTTP. These packages will be upgraded in a future release of ReadingRecord.

Configuration

Increase PHP's maximum execution time by changing the following value in '/etc/php.ini':

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 60     ; Maximum execution time of each script, in seconds

Note: For large sites, some reports can exceed the default maximum execution time of 30 seconds. This will (hopefully) be corrected in a future release of ReadingRecord.

Security Considerations

The following are optional, but recommended, steps to help improve the security of your ReadingRecord server.

Disable PHP's 'expose_php' setting. Although the comment indicates it is not a security threat, it may be possible for an attacker to probe for weaknesses in PHP by knowing the installed version. Plus if your library is routinely subject to security audits you will often get dinged for leaving this enabled.

  • Edit the PHP config file '/etc/php.ini' & change the following option:
    • ; Decides whether PHP may expose the fact that it is installed on the server
      ; (e.g. by adding its signature to the Web server header).  It is no security
      ; threat in any way, but it makes it possible to determine whether you use PHP
      ; on your server or not.
      expose_php = Off
  • Restart Apache for this change to take effect.

Navigation

 
docs/install_configure_php.txt (5112 views) · Last modified: 2015/02/10 09:04 by esisler