在 ubuntu 13.10 中安装 php 5.3?

在 ubuntu 13.10 中安装 php 5.3?

我的问题是,我在网上找到的脚本可以在 php 5.3 上运行,而不是较新的版本。我希望在本地开发网站,而不是上传部分更改。在阅读了大量资料后,我边读边编写了以下脚本。我还制作了一个视频,链接在本文底部。

#!/bin/bash
mkdir /opt/phpfcgi-5.3.24
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget http://de.php.net/get/php-5.3.24.tar.bz2/from/this/mirror -O php-5.3.24.tar.bz2
tar jxf php-5.3.24.tar.bz2
cd php-5.3.24/
apt-get install build-essential 
apt-get build-dep php5
apt-get install libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libc-client2007e libc-client2007e-dev
./configure \
--prefix=/opt/phpfcgi-5.3.24 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--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 \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--with-libdir=/lib/x86_64-linux-gnu \
--enable-ftp \
--with-kerberos \
--with-gettext \
--enable-cgi
make
make install 
cp /usr/local/src/php5-build/php-5.3.24/php.ini-production /opt/phpfcgi-5.3.24/lib/php.ini
apt-get -y install php-pear
cd /opt/phpfcgi-5.3.24/etc
pecl -C ./pear.conf update-channels
pecl -C ./pear.conf install apc
pecl -C ./pear.conf install memcache 
pecl -C ./pear.conf install memcached
cd /tmp
wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
tar xfvz ioncube_loaders_lin_x86.tar.gz
cp ioncube/ioncube_loader_lin_5.3.so /opt/phpfcgi-5.3.24/lib/php/extensions/no-debug-non-zts-20090626/ioncube.so
echo "[...]"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "extension=apc.so"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "apc.enabled=1"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "apc.shm_size=128M"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "apc.ttl=0"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "apc.user_ttl=600"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "apc.gc_ttl=600"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "apc.enable_cli=1"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "apc.mmap_file_mask=/tmp/apc.XXXXXX"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "extension=memcache.so"  >> /opt/phpfcgi-5.3.24/lib/php.ini
echo "extension=memcached.so"  >> /opt/phpfcgi-5.3.24/lib/php.ini
sed -i.bak "1i zend_extension \= \/opt\/phpfcgi-5.3.24\/lib\/php\/extensions\/no-debug-non-zts-20090626\/ioncube.so"  /opt/phpfcgi-5.3.24/lib/php.ini
kate /opt/phpfcgi-5.3.24/lib/php.ini
mkdir /var/www/cgi-bin
echo "#!/bin/sh" > /var/www/cgi-bin/php5324.fcgi
echo "PHP_FCGI_CHILDREN=3" >> /var/www/cgi-bin/php5324.fcgi
echo "export PHP_FCGI_CHILDREN" >> /var/www/cgi-bin/php5324.fcgi
echo "PHP_FCGI_MAX_REQUESTS=5000" >> /var/www/cgi-bin/php5324.fcgi
echo "export PHP_FCGI_MAX_REQUESTS" >> /var/www/cgi-bin/php5324.fcgi
echo "# which php-cgi binary to execute" >> /var/www/cgi-bin/php5324.fcgi
echo "exec /opt/phpfcgi-5.3.24/bin/php-cgi" >> /var/www/cgi-bin/php5324.fcgi
chmod +x /var/www/cgi-bin/php5324.fcgi
echo "<VirtualHost *:80>" > /etc/apache2/sites-available/dev.conf
echo "  ServerName dev.dev" >> /etc/apache2/sites-available/dev.conf
echo "  DocumentRoot /var/www" >> /etc/apache2/sites-available/dev.conf
echo "  <Directory \"/var/www\">" >> /etc/apache2/sites-available/dev.conf
echo "    Options Indexes FollowSymLinks MultiViews" >> /etc/apache2/sites-available/dev.conf
echo "    AllowOverride All" >> /etc/apache2/sites-available/dev.conf
echo "    Order allow,deny" >> /etc/apache2/sites-available/dev.conf
echo "    allow from all" >> /etc/apache2/sites-available/dev.conf
echo "    AddHandler php-cgi .php" >> /etc/apache2/sites-available/dev.conf
echo "    Action php-cgi /var/www/cgi-bin/php5324.fcgi" >> /etc/apache2/sites-available/dev.conf
echo "    <FilesMatch \"\.php$\">" >> /etc/apache2/sites-available/dev.conf
echo "    SetHandler php-cgi" >> /etc/apache2/sites-available/dev.conf
echo "    </FilesMatch>" >> /etc/apache2/sites-available/dev.conf
echo "  </Directory>" >> /etc/apache2/sites-available/dev.conf
echo "</VirtualHost>" >> /etc/apache2/sites-available/dev.conf
a2ensite dev
sed -i.bak "1i 127.0.0.1    dev.dev" /etc/hosts
service apache2 reload

http://larrykeenan.com/php53.html

提前感谢您。 Larry Keenan

答案1

我尝试使用该脚本并遇到错误。到目前为止,最新的 php5.3 版本是 5.3.28,不再是 5.3.24,因此请将脚本中的所有“5.3.24”字符串替换为“5.3.28”以重新开始工作

相关内容