![如何在安装 lampstack 的同时在 lubuntu 上安装 php 5.5.12?](https://linux22.com/image/1144562/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%AE%89%E8%A3%85%20lampstack%20%E7%9A%84%E5%90%8C%E6%97%B6%E5%9C%A8%20lubuntu%20%E4%B8%8A%E5%AE%89%E8%A3%85%20php%205.5.12%EF%BC%9F.png)
我已经按照这教程,但我需要安装 php 5.5.15 才能$ sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
安装 php 7.* 。
怎么做?
答案1
搭建php5.5.13
提取压缩包:
tar -xzvf php.tar.gz
更改到目录:
cd php-5.5.13
安装依赖项:
sudo apt install build-dep php5
配置 php 并添加到
/usr/local/php5513
:./configure --disable-debug --disable-rpath --enable-bcmath --enable-calendar -- enable-exif --enable-ftp --enable-fpm --enable-gd-native-ttf --enable-intl --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-pdo --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-xmlreader --enable-xmlwriter --enable-zip -- prefix=/usr/local/php5513 --with-bz2 --with-config-file-path=/usr/local/php5513/etc --with-config-file-scan-dir=/usr/local/php5513/php.d --with-curl --with-freetype-dir=/usr/local/php5513 --with-gd --with-gettext --with-gmp --with-iconv --with-imap --with-imap-ssl --with-xpm-dir=/usr/local/php5513 --with-vpx-dir=/usr/local/php5513 --with-kerberos --with-libdir=lib64 --with-libxml-dir=/usr/local/php5513 --with-mcrypt --with-openssl --with-pcre-regex --with-pdo-mysql --with-pic --with-png-dir=/usr/local/php5513 --with-snmp --with-xmlrpc --with-xsl --with-zlib --without-gdbm --with-mysqli
测试一下:
make; make test # Any errors please correct them
安装方式:
make install
复制示例
php.ini
文件并根据需要进行更改:cp php.ini-production /usr/local/php5513/etc/php.ini
笔记:
要使用其他 php 配置文件,请
mkdir /usr/local/php5513/php.d/
在那里添加它们。要根据您的喜好和需要配置 php,请注意
step 5
。根据需要删除和添加。
来源:
http://aarvik.dk/how-to-install-php-5-5-15-from-source-and-use-it-with-plesk/
https://www.brandonsavage.net/compiling-php-5-5-from-scratch/
答案2
到安装 Apache、PHP 和 MySQL, 跑步:
sudo apt-get install php7 libapache2-mod-php7 php7-mcrypt
或者:
sudo apt-get install php libapache2-mod-php php-mcrypt
或者:
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt