Нужную версию можно найти вот тут:
Thank you for reading this post, don't forget to subscribe!http://museum.php.net/php7/
1234 <span class="crayon-r">cd</span> <span class="crayon-o">/</span><span class="crayon-e">opt</span><span class="crayon-e">wget http://museum.php.net/php5/php-5.2.17.tar.gz</span><span class="crayon-e">tar </span><span class="crayon-e">xvf php-5.2.17.tar.gz</span><span class="crayon-r">cd</span> php-5.2.17
yum install \
libxml2-devel \
httpd-devel \
libXpm-devel \
gmp-devel \
libicu-devel \
t1lib-devel \
aspell-devel \
openssl-devel \
bzip2-devel \
libcurl-devel \
libjpeg-devel \
libvpx-devel \
libpng-devel \
freetype-devel \
readline-devel \
libtidy-devel \
libxslt-devel \
httpd-devel \
libxml2 \
libxml2-devel \
openssl \
openssl-devel \
bzip2 \
bzip2-devel \
curl \
curl-devel \
libjpeg \
libjpeg-devel \
libpng \
libpng-devel \
libXpm-devel \
freetype-devel \
t1lib-devel \
gmp-devel \
libicu-devel \
libmcrypt \
libmcrypt-devel \
aspell-devel \
libtidy \
libtidy-devel \
libxslt-devel \
libwebp-devel \
gcc-c++ \
wget \
gcc \
libxml2-devel \
openssl-devel \
libcurl-devel \
libpng-devel \
libmcrypt-devel \
libmhash-devel \
mysql-devel \
libtidy-devel \
libtool-ltdl-devel \
mhash mhash-devel \
glibc-headers \
libjpeg-devel*
если установлен mysql версии 5.5 то тогда установку производим без mysql-devel, и ставим его отдельно из репозитория remi
1 |
yum --enablerepo=remi install mysql-devel |
отметим, что mysql будет обновлён до версии 5.5.60
После этого начинаем собирать, у меня вот такие параметры:
./configure --prefix=/opt/php5217 --enable-force-cgi-redirect --disable-debug --enable-libxml --with-libxml-dir=/usr/local --enable-reflection --enable-spl --enable-zend-multibyte --with-regex=system --with-tidy --enable-zip --enable-bcmath --enable-calendar --with-curl=shared --enable-dba --enable-exif --enable-ftp --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-gettext=shared --enable-mbstring --with-mcrypt=/usr/include --with-mhash=shared --with-mysql --with-libdir=lib --with-openssl --with-pdo-mysql --enable-sockets --with-xsl --with-zlib --enable-pcntl --enable-soap --with-iconv --enable-exif --enable-ftp --with-curl --enable-magic-quotes --enable-cli --enable-fastcgi --enable-discard-path --enable-force-cgi-redirect --enable-cgi
в php5.2 mysqlnd не поддерживается, поэтому собираем без --with-mysqli
make
make install
nano /var/www/user1/php-cgi/php.5217.cgi
PHPRC="/opt/php5217/"
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/php5217/bin/php-cgi[/spoiler]
12 <span class="crayon-v">chmod</span> <span class="crayon-o">+</span><span class="crayon-v">x /var/www/user1/php-cgi/php.5217.cgichown user1:user1 /var/www/user1/php-cgi/php.5217.cgi</span>
теперь достаточно в настройках виртуального хоста добавить следующую запись и будет работать PHP 5.2.17
SetHandler application/x-httpd-php5
</FilesMatch>
ScriptAlias /php5217-cgi /var/www/user1/php-cgi/php.5217.cgi
Action application/x-httpd-php5 /php5217-cgi
AddHandler application/x-httpd-php5 .php[/spoiler]
после, не забываем перезапускать апач
/etc/init.d/httpd restart
1 2 3 4 5 6 |
<span class="crayon-r">cd</span> <span class="crayon-o">/</span><span class="crayon-e">opt</span> http://museum.php.net/php5/php-5.3.29.tar.gz tar <span class="crayon-e">xvf </span>php-5.3.29.tar.gz cd php-5.3.29 |
Пакеты можно не ставить, так как они уже стоят.
Перейдём к сборке, директория для сборки /opt/php5329
./configure --prefix=/opt/php5329 --enable-force-cgi-redirect --disable-debug --enable-libxml --with-libxml-dir=/usr/local --enable-reflection --enable-spl --enable-zend-multibyte --with-regex=system --with-tidy --enable-zip --enable-bcmath --enable-calendar --with-curl=shared --enable-dba --enable-exif --enable-ftp --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-gettext=shared --enable-mbstring --with-mcrypt=/usr/include --with-mhash=shared --with-mysql --with-libdir=lib --with-openssl --with-pdo-mysql --enable-sockets --with-xsl --with-zlib --enable-pcntl --enable-soap --with-iconv --enable-exif --enable-ftp --with-curl --enable-magic-quotes --enable-cli --enable-fastcgi --enable-discard-path --enable-force-cgi-redirect --enable-cgi --with-mysqli
Если ошибок нет, выполняем make make install
создаём Wrapper /var/www/user1/php-cgi/php.5329.cgi
Меняем владельца и права:
chown user1:user1 /var/www/user1/php-cgi/php.5329.cgi
chmod +x /var/www/user1/php-cgi/php.5329.cgi
добавляем в файл следующее содержимое:
PHPRC="/opt/php5329/"
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/php5329/bin/php-cgi[/spoiler]
SetHandler application/x-httpd-php5
</FilesMatch>
ScriptAlias /php5329-cgi /var/www/user1/php-cgi/php.5329.cgi
Action application/x-httpd-php5 /php5329-cgi
AddHandler application/x-httpd-php5 .php[/spoiler]
1 2 3 4 5 6 7 |
перезапускаем апач /etc/init.d/httpd restart php.ini можно скопировать от нативной версии: [root@centos6 php5329]# cp /etc/php.ini /opt/php5329/lib/ [root@centos6 php5329]# /opt/php5329/bin/php -i | grep 'Loaded Configuration File' Loaded Configuration File => /opt/php5329/lib/php.ini |
1 2 3 |
Так же мы можем подменить версию PHP (нативную) mv /usr/bin/php-cgi /usr/bin/php-cgi.back ln -s /opt/php5329/bin/php-cgi /usr/bin/php-cgi |
ставим PHP7.1.9
cd /opt/alt.php/
wget http://museum.php.net/php7/php-7.1.9.tar.gz
tar xvfz php-7.1.9.tar.gz
cd php-7.1.9
mkdir /opt/alt.php/php7.1.9/
./configure --prefix=/opt/alt.php/php7.1.9/ --with-config-file-path=/opt/alt.php/php7.1.9/ --with-config-file-scan-dir=/opt/alt.php/php7.1.9/php.d/--with-layout=PHP --with-openssl --with-pear --enable-calendar --with-gmp --enable-exif --with-mcrypt --with-mhash --with-mhash --with-zlib --with-bz2 --enable-zip --enable-ftp --enable-mbstring --with-iconv --enable-intl --with-icu-dir=/usr --with-gettext --with-pspell --enable-sockets --with-openssl -with-curl --with-gd --enable-gd-native-ttf --with-libdir=lib64 --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-webp-dir=/usr --with-freetype-dir=/usr --with-libxml-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-exif --enable-shmop --enable-soap --with-xmlrpc --with-xsl --with-tidy=/usr --enable-pcntl
make && make install
rm -rf /opt/alt.php/php-7.1.9
cp /etc/php.d/*.ini /opt/alt.php/php7.1.9/php.d/
cp /etc/php.ini /opt/alt.php/php7.1.9/php.d/
ставим PHP7.0.9
cd /opt/alt.php/
wget http://museum.php.net/php7/php-7.0.9.tar.gz
tar xvfz php-7.0.9.tar.gz
cd php-7.0.9
mkdir /opt/alt.php/php7.0.9/
./configure --prefix=/opt/alt.php/php7.0.9/ --with-config-file-path=/opt/alt.php/php7.0.9/ --with-config-file-scan-dir=/opt/alt.php/php7.0.9/php.d/ --with-layout=PHP --with-openssl --with-pear --enable-calendar --with-gmp --enable-exif --with-mcrypt --with-mhash --with-mhash --with-zlib --with-bz2 --enable-zip --enable-ftp --enable-mbstring --with-iconv --enable-intl --with-icu-dir=/usr --with-gettext --with-pspell --enable-sockets --with-openssl -with-curl --with-gd --enable-gd-native-ttf --with-libdir=lib64 --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-webp-dir=/usr --with-freetype-dir=/usr --with-libxml-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-exif --enable-shmop --enable-soap --with-xmlrpc --with-xsl --with-tidy=/usr --enable-pcntl
make && make install
rm -rf /opt/alt.php/php-7.0.9
cp /etc/php.d/*.ini /opt/alt.php/php7.0.9/php.d/
cp /etc/php.ini /opt/alt.php/php7.0.9/php.d/
ставим PHP5.6.9
cd /opt/alt.php/
wget http://museum.php.net/php5/php-5.6.9.tar.gz
tar xvzf php-5.6.9.tar.gz
cd php-5.6.9
mkdir /opt/alt.php/php5.6.9/
./configure --prefix=/opt/alt.php/php5.6.9/ --with-config-file-path=/opt/alt.php/php5.6.9/ --with-config-file-scan-dir=/opt/alt.php/php5.6.9/php.d/ --with-layout=PHP --with-openssl --with-pear --enable-calendar --with-gmp --enable-exif --with-mcrypt --with-mhash --with-mhash --with-zlib --with-bz2 --enable-zip --enable-ftp --enable-mbstring --with-iconv --enable-intl --with-icu-dir=/usr --with-gettext --with-pspell --enable-sockets --with-openssl -with-curl --with-gd --enable-gd-native-ttf --with-libdir=lib64 --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-webp-dir=/usr --with-freetype-dir=/usr --with-libxml-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-exif --enable-shmop --enable-soap --with-xmlrpc --with-xsl --with-tidy=/usr --enable-pcntl
make && make install
rm -rf /opt/alt.php/php-5.6.9
cp /etc/php.d/*.ini /opt/alt.php/php5.6.9/php.d/
cp /etc/php.ini /opt/alt.php/php5.6.9/php.d/
ставим PHP5.5.9
wget http://museum.php.net/php5/php-5.5.9.tar.gz
tar xvzf php-5.5.9.tar.gz
cd php-5.5.9
mkdir /opt/alt.php/php5.5.9/
./configure --prefix=/opt/alt.php/php5.5.9/ --with-config-file-path=/opt/alt.php/php5.5.9/ --with-config-file-scan-dir=/opt/alt.php/php5.5.9/php.d/ --with-layout=PHP --with-openssl --with-pear --enable-calendar --with-gmp --enable-exif --with-mcrypt --with-mhash --with-mhash --with-zlib --with-bz2 --enable-zip --enable-ftp --enable-mbstring --with-iconv --enable-intl --with-icu-dir=/usr --with-gettext --with-pspell --enable-sockets --with-openssl -with-curl --with-gd --enable-gd-native-ttf --with-libdir=lib64 --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-webp-dir=/usr --with-freetype-dir=/usr --with-libxml-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-exif --enable-shmop --enable-soap --with-xmlrpc --with-xsl --with-tidy=/usr --enable-pcntl
make && make install
rm -rf /opt/alt.php/php-5.5.9
cp /etc/php.d/*.ini /opt/alt.php/php5.5.9/php.d/
cp /etc/php.ini /opt/alt.php/php5.5.9/php.d/
ставим PHP5.4.9
wget http://museum.php.net/php5/php-5.4.9.tar.gz
tar xvzf php-5.4.9.tar.gz
cd php-5.4.9
mkdir /opt/alt.php/php5.4.9/
./configure --prefix=/opt/alt.php/php5.4.9/ --with-config-file-path=/opt/alt.php/php5.4.9/ --with-config-file-scan-dir=/opt/alt.php/php5.4.9/php.d/ --with-layout=PHP --with-openssl --with-pear --enable-calendar --with-gmp --enable-exif --with-mcrypt --with-mhash --with-mhash --with-zlib --with-bz2 --enable-zip --enable-ftp --enable-mbstring --with-iconv --enable-intl --with-icu-dir=/usr --with-gettext --with-pspell --enable-sockets --with-openssl -with-curl --with-gd --enable-gd-native-ttf --with-libdir=lib64 --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-webp-dir=/usr --with-freetype-dir=/usr --with-libxml-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-exif --enable-shmop --enable-soap --with-xmlrpc --with-xsl --with-tidy=/usr --enable-pcntl --with-vpx-dir=/usr --with-libdir=lib --with-xpm-dir=/usr
make && make install
rm -rf /opt/alt.php/php-5.4.9
cp /etc/php.d/*.ini /opt/alt.php/php5.4.9/php.d/
cp /etc/php.ini /opt/alt.php/php5.4.9/php.d/
ставим PHP5.3.9
wget http://museum.php.net/php5/php-5.3.9.tar.gz
tar php-5.3.9.tar.gz
cd php-5.3.9
mkdir /opt/alt.php/php5.3.9/
./configure --prefix=/opt/alt.php/php5.3.9/ --with-config-file-path=/opt/alt.php/php5.3.9/ --with-config-file-scan-dir=/opt/alt.php/php5.3.9/php.d/ --with-layout=PHP --with-openssl --with-pear --enable-calendar --with-gmp --enable-exif --with-mcrypt --with-mhash --with-mhash --with-zlib --with-bz2 --enable-zip --enable-ftp --enable-mbstring --with-iconv --enable-intl --with-icu-dir=/usr --with-gettext --with-pspell --enable-sockets --with-openssl -with-curl --with-gd --enable-gd-native-ttf --with-libdir=lib64 --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --with-libxml-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-exif --enable-shmop --enable-soap --with-xmlrpc --with-xsl --with-tidy=/usr --enable-pcntl --with-libdir=lib --with-xpm-dir=/usr
make && make install
rm -rf /opt/alt.php/php-5.3.9
cp /etc/php.d/*.ini /opt/alt.php/php5.3.9/php.d/
cp /etc/php.ini /opt/alt.php/php5.3.9/php.d/
Создаём Wrapper
PHPRC задаёт откуда брать php.ini
5.3
/var/www/user1/php-cgi/wprapper.php5.3.9.cgi
PHPRC=/opt/alt.php/php5.3.9
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/alt.php/php5.3.9/bin/php-cgi[/spoiler]
PHPRC=/opt/alt.php/php5.4.9
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/alt.php/php5.4.9/bin/php-cgi[/spoiler]
PHPRC=/opt/alt.php/php5.5.9
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/alt.php/php5.5.9/bin/php-cgi[/spoiler]
PHPRC=/opt/alt.php/php5.6.9
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/alt.php/php5.6.9/bin/php-cgi[/spoiler]
PHPRC=/opt/alt.php/php7.0.9
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/alt.php/php7.0.9/bin/php-cgi[/spoiler]
PHPRC=/opt/alt.php/php7.1.9
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/alt.php/php7.1.9/bin/php-cgi[/spoiler]
Меняем версию PHP в virtualhost сайта, указав путь до FCGIWrapper :
<VirtualHost *:8080>
ServerAdmin webmaster@test.t
DocumentRoot /var/www/user1/site/test.t
ServerName test.t
ServerAlias www.test.t
ErrorLog /var/www/user1/logs/test.t.error.log
CustomLog /var/www/user1/logs/test.t.access.log common
<IfModule mod_fcgid.c>
SuexecUserGroup user1 user1
<Directory /var/www/user1/site/test.t>
Options +ExecCGI
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /var/www/user1/php-cgi/wrapper.php7.1.9.cgi .php
Order allow,deny
Allow from all
</Directory>
</IfModule>
</VirtualHost>[/spoiler]