ISPManager - устанавливаем 2 версии php - 5.4 и 5.3


Материал из Wiki - Iphoster - 'the best ever support'

Перейти к: навигация, поиск

ISPManager - устанавливаем 2 версии php - 5.4 и 5.3 по схеме:

  • php 5.4 будет работать как модуль Apache
  • php 5.3 будет работать как cgi (переключается через ISPManager --> WWW домены)
  • + обновим mysql-server с 5.1 до 5.5


После установки панели подключаем репозитории:

В примере взята ОС CentOS6-x86:

epel уже подключен. 
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm Retrieving http://rpms.famillecollet.com/enterprise/remi-release-6.rpm warning: /var/tmp/rpm-tmp.HcwuzA: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY Preparing... ########################################### [100%] 1:remi-release ########################################### [100%]
# rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm Retrieving http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm Preparing... ########################################### [100%] 1:rpmforge-release ########################################### [100%]


Смотрим версию mysql:

#  yum --enablerepo=epel,remi,rpmforge info mysql-server
Available Packages
Name        : mysql-server
Arch        : i686
Version     : 5.5.40
Release     : 1.el6.remi


Сносим php 5.3 и mysql 5.1:

# yum remove php-\*
# yum remove mysql-\*


Устанавливаем php 5.4 и mysql 5.5 :

# yum --enablerepo=epel,remi,rpmforge install mysql-server mysql-devel php php-mysql php-devel
# yum --enablerepo=epel,remi,rpmforge install php-gd php-mbstring php-common php-mcrypt php-xml
# yum --enablerepo=remi install php-ioncube-loader.i686


Проверяем версию:

# php -v
PHP 5.4.34 (cli) (built: Oct 16 2014 10:07:36)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
   with the ionCube PHP Loader v4.7.0, Copyright (c) 2002-2014, by ionCube Ltd.  
# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) # /etc/init.d/mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ] # mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) # rpm -qa | grep mysql mysql-libs-5.5.40-1.el6.remi.i686 compat-mysql51-5.1.54-1.el6.remi.i686 php-mysql-5.4.34-1.el6.remi.i686 mysql-5.5.40-1.el6.remi.i686 mysql-server-5.5.40-1.el6.remi.i686 mysql-devel-5.5.40-1.el6.remi.i686


# /etc/init.d/mysqld stop
# mysqld_safe --skip-grant-tables &
# mysql_upgrade
# /etc/init.d/mysqld stop
# /etc/init.d/mysqld start


Ставим заново phpmyadmin и squirrelmail

# /usr/local/ispmgr/sbin/pkgctl cache
# yum --enablerepo=remi install phpMyAdmin squirrelmail
# /usr/local/ispmgr/sbin/pkgctl activate myadmin
# /usr/local/ispmgr/sbin/pkgctl activate webmail


Компилируем и устанавливаем php 5.3.x

# cd /tmp/
# wget -c http://ua2.php.net/get/php-5.3.29.tar.gz/from/this/mirror -O php-5.3.29.tar.gz
# tar -xzvf php-5.3.29.tar.gz
# cd php-5.3.29

Ставим дополнительные пакеты

# yum install libxml2-devel bzip2-devel curl-devel libjpeg-devel libpng-devel libX11-devel gd-devel 
libc-client libc-client-devel libmcrypt-devel mysql-devel gcc


Конфигурируем для i386:

# ./configure --prefix=/opt/php53 --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr 
--enable-soap  --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --disable-rpath 
--enable-inline-optimization --with-bz2  --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm 
--enable-pcntl  --enable-mbregex --with-mhash --enable-zip  --with-pcre-regex --with-mysql 
--with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf
--with-openssl --enable-ftp --with-imap-ssl --with-kerberos --with-gettext --enable-cgi      
creating libtool appending configuration tag "CXX" to libtool Generating files updating cache ./config.cache creating ./config.status creating php5.spec creating main/build-defs.h creating scripts/phpize creating scripts/man1/phpize.1 creating scripts/php-config creating scripts/man1/php-config.1 creating sapi/cli/php.1 creating main/php_config.h creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP.


Компилим:

# make && make install 
Generating phar.php Generating phar.phar PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. pharcommand.inc directorygraphiterator.inc invertedregexiterator.inc directorytreeiterator.inc clicommand.inc phar.inc
Build complete. Don't forget to run 'make test'.
Installing PHP SAPI module: cgi Installing PHP CGI binary: /opt/php53/bin/ Installing PHP CLI binary: /opt/php53/bin/ Installing PHP CLI man page: /opt/php53/man/man1/ Installing build environment: /opt/php53/lib/php/build/ Installing header files: /opt/php53/include/php/ Installing helper programs: /opt/php53/bin/ program: phpize program: php-config Installing man pages: /opt/php53/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /opt/php53/lib/php/ [PEAR] Archive_Tar - installed: 1.3.12 [PEAR] Console_Getopt - installed: 1.3.1 [PEAR] Structures_Graph- installed: 1.0.4 [PEAR] XML_Util - installed: 1.2.3 [PEAR] PEAR - installed: 1.9.5 Warning! a PEAR user config file already exists from a previous PEAR installation at '/root/.pearrc'. You may probably want to remove it. Wrote PEAR system config file at: /opt/php53/etc/pear.conf You may want to add: /opt/php53/lib/php to your php.ini include_path /tmp/php-5.3.29/build/shtool install -c ext/phar/phar.phar /opt/php53/bin ln -s -f /opt/php53/bin/phar.phar /opt/php53/bin/phar Installing PDO headers: /opt/php53/include/php/ext/pdo/


Подменяем версию на 5.3:

# mv /usr/bin/php-cgi /usr/bin/php-cgi.back
# ln -s /opt/php53/bin/php-cgi /usr/bin/php-cgi

Завершаем

# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]


+ Проверить в файле:

# vi /etc/httpd/conf.d/php.conf
чтобы не было строк или закомментировать их.
#<FilesMatch \.php$>
#    SetHandler application/x-httpd-php
#</FilesMatch>


Переключаем версии через ISPManager --> WWW домены:


Ispmgr-2php.png

Индекс цитирования