博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
VestaCP安装php-5.2.7
阅读量:6224 次
发布时间:2019-06-21

本文共 4551 字,大约阅读时间需要 15 分钟。

hot3.png

centos6上的VestaCP都是支持在php5.4以上版本,但是有些老网站还是php5.2写的,为了支持这些老网站,研究了下VestaCP支持php5.2的方法

1.yum groupinstall ‘Development Tools’

2. yum install \

libxml2-dev* \
libmhash-dev* \
libcurl-dev* \
libpng* \
libjpeg* \
libtidy-dev* \
libxslt-dev* \
libtool-ltdl-dev* \
mcrypt \
libmcrypt-dev* \
libXpm-dev* \
libsqlite* \
mysql-dev* \
mysql-libs \
sqlite-dev* \
freetype-dev* \
openssl-dev* \
bzip2-dev* \
unzip* \
patch \
make \
gcc*

yum –enablerepo=remi,remi-test install mysql-devel

3.mkdir /opt/php-5.2.17

4. mkdir -p /usr/src/php/ && cd /usr/src/php/

5. wget -c -t0 http://museum.php.net/php5/php-5.2.17.tar.gz

6. tar zxf php-5.2.17.tar.gz

7. cd /usr/src/php/php-5.2.17/

8.wget http://php52-backports.googlecode.com/files/php52-backports-20130717.patch

9.patch -p1 < php52-backports-20130717.patch

./configure \

–prefix=/opt/php-5.2.17 \
–with-config-file-path=/opt/php-5.2.17 \
–with-libdir=lib64 \
–with-mysql \
–with-mysqli \
–with-sqlite=shared \
–with-curl \
–with-gd \
–with-openssl \
–with-pdo-mysql=shared –with-pdo-sqlite=shared \
–with-mcrypt \
–with-pear \
–with-pic \
–with-jpeg-dir \
–with-png-dir \
–with-ttf \
–with-freetype-dir \
–with-xmlrpc \
–with-xpm-dir \
–with-zlib \
–enable-bcmath \
–enable-calendar \
–enable-cli \
–enable-discard-path \
–enable-fastcgi \
–enable-ftp \
–enable-force-cgi-redirect \
–enable-gd-native-ttf \
–enable-libxml \
–enable-mbstring \
–enable-pdo=shared \
–enable-soap \
–enable-sockets \
–enable-session \
–enable-zip \
–enable-zend-multibyte

 

此步骤如果出现 Requires: mysql = 5.1.73-3.el6_5 这种错误,执行下面命令:

这个是编译php5.2.7的命令,如果是32位的 要换成 –with-libdir=lib

11. make && make install

12.cp /usr/src/php/php-5.2.17/php.ini-recommended /opt/php-5.2.17/lib/php.ini

13./opt/php-5.2.17/bin/php-cgi -v

14. vi /usr/local/vesta/data/templates/web/httpd/phpfcgid_52.sh

写入如下内容:

#!/bin/bash

# Adding php wrapper
user=”$1″
domain=”$2″
ip=”$3″
home_dir=”$4″
docroot=”$5″

wrapper_script=”#!/bin/sh

export PHPRC=/opt/php-5.2.17/lib/
export PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN=20
exec /opt/php-5.2.17/bin/php-cgi
wrapper_file=”$home_dir/$user/web/$domain/cgi-bin/fcgi-starter”

echo “$wrapper_script” > $wrapper_file

chown $user:$user $wrapper_file
chmod -f 751 $wrapper_file

exit 0

15. vi /usr/local/vesta/data/templates/web/httpd/phpfcgid_52.tpl

写下如下内容:

<VirtualHost %ip%:%web_port%>

ServerName %domain_idn%

%alias_string%
ServerAdmin %email%
DocumentRoot %docroot%
ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/
SuexecUserGroup %user% %group%
CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
CustomLog /var/log/%web_system%/domains/%domain%.log combined
ErrorLog /var/log/%web_system%/domains/%domain%.error.log
<Directory %docroot%>
AllowOverride All
Options +Includes -Indexes +ExecCGI
<Files *.php>
SetHandler fcgid-script
</Files>
FCGIWrapper %home%/%user%/web/%domain%/cgi-bin/fcgi-starter .php
</Directory>
<Directory %home%/%user%/web/%domain%/stats>
AllowOverride All
</Directory>

Include %home%/%user%/conf/web/%web_system%.%domain%.conf*

</VirtualHost>

 

16. vi /usr/local/vesta/data/templates/web/httpd/phpfcgid_52.stpl

写下如下内容:

<VirtualHost %ip%:%web_ssl_port%>

ServerName %domain_idn%

%alias_string%
ServerAdmin %email%
DocumentRoot %sdocroot%
ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
Alias /vstats/ %home%/%user%/web/%domain%/stats/
Alias /error/ %home%/%user%/web/%domain%/document_errors/
SuexecUserGroup %user% %group%
CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
CustomLog /var/log/%web_system%/domains/%domain%.log combined
ErrorLog /var/log/%web_system%/domains/%domain%.error.log
<Directory %sdocroot%>
SSLRequireSSL
AllowOverride All
Options +Includes -Indexes +ExecCGI
<Files *.php>
SetHandler fcgid-script
</Files>
FCGIWrapper %home%/%user%/web/%domain%/cgi-bin/fcgi-starter .php
</Directory>
<Directory %home%/%user%/web/%domain%/stats>
AllowOverride All
</Directory>
php_admin_value open_basedir none
SSLEngine on
SSLVerifyClient none
SSLCertificateFile %ssl_crt%
SSLCertificateKeyFile %ssl_key%
%ssl_ca_str%SSLCertificateChainFile %ssl_ca%

Include %home%/%user%/conf/web/s%web_system%.%domain%.conf*

</VirtualHost>

17.安装完成,执行下面命令

chmod +x /usr/local/vesta/data/templates/web/httpd/phpfcgid_52.sh && \

chmod +x /usr/local/vesta/data/templates/web/httpd/phpfcgid_52.tpl && \
chmod +x /usr/local/vesta/data/templates/web/httpd/phpfcgid_52.stpl

service httpd restart

 

18.再登录vestacp的后台,添加网站。

转载于:https://my.oschina.net/u/2294923/blog/811478

你可能感兴趣的文章
leetcode-686-Repeated String Match(重复多少次A能够找到B)
查看>>
github page+jekyll构建博客的解决方案
查看>>
2013-7-22 确定鼠标与控件位置关系
查看>>
列、约束重命名,原数据不丢失
查看>>
【笔记】老程序员从头开始学JQuery的读书笔记02
查看>>
单点登录系统(一)
查看>>
[转]性能测试之性能计数器和监测工具
查看>>
HZAU1098: Yifan and War3(区间dp)
查看>>
html
查看>>
关于ajax中async: false的作用
查看>>
GitHub帮助文档翻译1——helloWorld
查看>>
文件的下载,随机验证码(无验证)登录注册
查看>>
第27章 java I/O输入输出流
查看>>
search-a-2d-matrix
查看>>
Ubuntu 12.04 Virtualbox 启用USB 设备支持
查看>>
C# DataTable的常用用法讲解
查看>>
〖Linux〗秒开www.stackoverflow.com,非代理方式
查看>>
〖Linux〗Linux的smb地址转换Windows格式(两者互转)
查看>>
mnesia
查看>>
python编程基础之二十一
查看>>