16.04 安裝 php5-oldstable失敗 [論壇 - 伺服器架設]


正在瀏覽:   1 名遊客


 到底部   前一個主題   下一個主題  [無發表權] 請登錄或者註冊



16.04 安裝 php5-oldstable失敗
會員一級
註冊日期:
6/20 18:27:44
所屬群組:
已註冊使用者
等級: 1
HP : 0 / 0
MP : 0 / 0
EXP: 2
離線
大家好,我在16.04想要安裝php5.4,爬文看到說要透過php5-oldstable,不過一開始似乎就碰到問題了,我在執行下面指令就出現了這些訊息,不知道該如何下手。

不好意思,麻煩大家了,謝謝!

sudo apt-add-repository ppa:ondrej/php5-oldstable


Cannot add PPA: 'ppa:~ondrej/ubuntu/php5-oldstable'.
The user named '~ondrej' has no PPA named 'ubuntu/php5-oldstable'
Please choose from the following available PPAs:
 * 'apache2':  PPA for Apache 2.x
 * 'apache2-qa':  PPA for Apache2 (QA builds; experimental)
 * 'autotools':  PPA for autotools (not-supported; build-dependency; experimental)
 * 'bind9':  PPA for BIND 9
 * 'cmake':  PPA for CMake (not-supported, experimental)
 * 'common':  Common PPA packages
 * 'courier':  PPA for Courier MTA
 * 'cyrus-imapd':  PPA for Cyrus IMAP
 * 'debhelper':  PPA for Debhelper (and friends)
 * 'golang':  PPA for Go (experimental, build-dependency)
 * 'llvm':  PPA for LLVM
 * 'mariadb-10.0':  PPA for MariaDB 10.0 (don't use, broken)
 * 'mysql-5.5':  PPA for MySQL 5.5 (don't use, broken)
 * 'mysql-5.6':  PPA for MySQL 5.6 (don't use, broken)
 * 'mysql-5.7':  PPA for MySQL 5.7 (don't use, broken)
 * 'nginx':  PPA for NGINX with HTTP/2 on Ubuntu 14.04 LTS and higher
 * 'nginx-mainline':  PPA for NGINX Mainline with HTTP/2 on Ubuntu 14.04 LTS and higher
 * 'pelican':  PPA for Pelican
 * 'php':  ***** The main PPA for supported PHP versions with many PECL extensions *****
 * 'php-qa':  PPA for PHP (QA builds; experimental)
 * 'php-zts':  PPA for PHP ZTS (experimental, unsupported)
 * 'php5-compat':  PPA with dummy compatibility php5* packages
 * 'pkg-dpkg':  dpkg and friends (very experimental)
 * 'pkg-gearman':  PPA for Gearman
 * 'pkg-nlnetlabs':  NLNetLabs Backported Packages
 * 'sandbox':  Sandbox for preparation of various packages (DON'T USE)
 * 'seafile':  PPA for Seafile
 * 'unbound':  PPA for Unbound (mainly a build-dep)
 * 'zonemaster':  PPA for Zonemaster

6/20 20:01:12
應用擴展 工具箱
回覆: 16.04 安裝 php5-oldstable失敗
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 34
HP : 165 / 828
MP : 542 / 15927
EXP: 12
離線
[回到索引]

================================================================================

julian560 寫到:
大家好,我在16.04想要安裝php5.4,爬文看到說要透過php5-oldstable,不過一開始似乎就碰到問題了,我在執行下面指令就出現了這些訊息,不知道該如何下手。

不好意思,麻煩大家了,謝謝!

sudo apt-add-repository ppa:ondrej/php5-oldstable

julian560 寫到: Cannot add PPA: 'ppa:~ondrej/ubuntu/php5-oldstable'. The user named '~ondrej' has no PPA named 'ubuntu/php5-oldstable' Please choose from the following available PPAs: * 'apache2': PPA for Apache 2.x * 'apache2-qa': PPA for Apache2 (QA builds; experimental) * 'autotools': PPA for autotools (not-supported; build-dependency; experimental) * 'bind9': PPA for BIND 9 * 'cmake': PPA for CMake (not-supported, experimental) * 'common': Common PPA packages * 'courier': PPA for Courier MTA * 'cyrus-imapd': PPA for Cyrus IMAP * 'debhelper': PPA for Debhelper (and friends) * 'golang': PPA for Go (experimental, build-dependency) * 'llvm': PPA for LLVM * 'mariadb-10.0': PPA for MariaDB 10.0 (don't use, broken) * 'mysql-5.5': PPA for MySQL 5.5 (don't use, broken) * 'mysql-5.6': PPA for MySQL 5.6 (don't use, broken) * 'mysql-5.7': PPA for MySQL 5.7 (don't use, broken) * 'nginx': PPA for NGINX with HTTP/2 on Ubuntu 14.04 LTS and higher * 'nginx-mainline': PPA for NGINX Mainline with HTTP/2 on Ubuntu 14.04 LTS and higher * 'pelican': PPA for Pelican * 'php': ***** The main PPA for supported PHP versions with many PECL extensions ***** * 'php-qa': PPA for PHP (QA builds; experimental) * 'php-zts': PPA for PHP ZTS (experimental, unsupported) * 'php5-compat': PPA with dummy compatibility php5* packages * 'pkg-dpkg': dpkg and friends (very experimental) * 'pkg-gearman': PPA for Gearman * 'pkg-nlnetlabs': NLNetLabs Backported Packages * 'sandbox': Sandbox for preparation of various packages (DON'T USE) * 'seafile': PPA for Seafile * 'unbound': PPA for Unbound (mainly a build-dep) * 'zonemaster': PPA for Zonemaster



我不清楚詳細的步驟如何解決您原本要執行的議題「16.04想要安裝php5.4」,

不過可以先引導您去研究關於「PPA (Personal Package Archive)」的概念,

可以先參考這篇文章「Ubuntu Linux 新增與移除 PPA 個人套件庫指令教學 - G. T. Wang」。

* https://help.launchpad.net/Packaging/PPA/InstallingSoftware
* https://help.launchpad.net/Packaging
* https://help.launchpad.net/Packaging/PPA

也可以對照 manpage 來閱讀

$ man add-apt-repository

接著關於您原本要執行的「sudo apt-add-repository ppa:ondrej/php5-oldstable」。

您可以用「ondrej」當關鍵字找尋,

就可以找到下面這個網址

* https://launchpad.net/~ondrej

您點進去這個網址,就可以看到下方有一個「Personal package archives」的標題,然後下面有列表,
那個列表,您可以對照您原本貼的訊息(下面藍色)

julian560 寫到:
Cannot add PPA: 'ppa:~ondrej/ubuntu/php5-oldstable'.
The user named '~ondrej' has no PPA named 'ubuntu/php5-oldstable'
Please choose from the following available PPAs:
 * 'apache2':  PPA for Apache 2.x
 * 'apache2-qa':  PPA for Apache2 (QA builds; experimental)
 * 'autotools':  PPA for autotools (not-supported; build-dependency; experimental)
 * 'bind9':  PPA for BIND 9
 * 'cmake':  PPA for CMake (not-supported, experimental)
 * 'common':  Common PPA packages
 * 'courier':  PPA for Courier MTA
 * 'cyrus-imapd':  PPA for Cyrus IMAP
 * 'debhelper':  PPA for Debhelper (and friends)
 * 'golang':  PPA for Go (experimental, build-dependency)
 * 'llvm':  PPA for LLVM
 * 'mariadb-10.0':  PPA for MariaDB 10.0 (don't use, broken)
 * 'mysql-5.5':  PPA for MySQL 5.5 (don't use, broken)
 * 'mysql-5.6':  PPA for MySQL 5.6 (don't use, broken)
 * 'mysql-5.7':  PPA for MySQL 5.7 (don't use, broken)
 * 'nginx':  PPA for NGINX with HTTP/2 on Ubuntu 14.04 LTS and higher
 * 'nginx-mainline':  PPA for NGINX Mainline with HTTP/2 on Ubuntu 14.04 LTS and higher
 * 'pelican':  PPA for Pelican
 * 'php':  ***** The main PPA for supported PHP versions with many PECL extensions *****
 * 'php-qa':  PPA for PHP (QA builds; experimental)
 * 'php-zts':  PPA for PHP ZTS (experimental, unsupported)
 * 'php5-compat':  PPA with dummy compatibility php5* packages
 * 'pkg-dpkg':  dpkg and friends (very experimental)
 * 'pkg-gearman':  PPA for Gearman
 * 'pkg-nlnetlabs':  NLNetLabs Backported Packages
 * 'sandbox':  Sandbox for preparation of various packages (DON'T USE)
 * 'seafile':  PPA for Seafile
 * 'unbound':  PPA for Unbound (mainly a build-dep)
 * 'zonemaster':  PPA for Zonemaster



================================================================================

之前有紀錄一個索引「[索引] 套件操作實務」,可以找到相關的討論案例,關於「套件庫」

例如這篇「#2 回覆: apt 出現許多錯誤訊息」。


簡易的套件庫範例

* https://github.com/samwhelp/play-ubuntu-18.04-ppa
* https://github.com/samwhelp/demo-repository-ubuntu

================================================================================

後來使用「php multi version」當關鍵字查詢

找到一篇「How to Install Different PHP (5.6, 7.0 and 7.1) Versions in Ubuntu

裡面就有提到「sudo add-apt-repository ppa:ondrej/php」,猜測您應是參考這篇文章,或是參考類似的文章

================================================================================

若不能透過安裝套件的方式安裝,提供另一個方向

之前知道有一個專案「Phpbrew (GitHub)」,
我沒有實際去測試過,所以不確定是否能解決您的問題
提供您參考,給您一個方向去研究測試和確認

再不然最終的方向,就是要研究自行編譯php成apache的模組了

* http://php.net/releases/
* http://php.net/downloads.php
* http://php.net/manual/en/install.unix.php
* http://php.net/manual/en/install.php


================================================================================

以下我測試的環境是「Ubuntu 18.04」

以下只是簡易的探索紀錄

執行


$ apt-cache show php | grep '^Depends:'



顯示


Depends: php7.2



執行


$ apt-cache show php7.2 | grep '^Depends:'



顯示


Depends: libapache2-mod-php7.2 | php7.2-fpm | php7.2-cgi, php7.2-common




執行


$ apt-cache showsrc php7.2 | grep '^Build-Depends:'



顯示


Build-Depends: apache2-dev (>= 2.4), autoconf (>= 2.63), automake, bison, chrpath, debhelper (>= 9), default-libmysqlclient-dev | libmysqlclient-dev, default-mysql-server | mysql-server | virtual-mysql-server, dh-apache2, dh-systemd (>= 1.3) [linux-any] | base-files (<< 7.2ubuntu5~) [linux-any], dpkg-dev (>= 1.16.1~), firebird-dev [!hurd-any !m68k !hppa !ppc64] | firebird2.5-dev [!hurd-any !m68k !hppa !ppc64] | firebird2.1-dev [!hurd-any !m68k !hppa !ppc64], flex, freetds-dev, libapparmor-dev, libapr1-dev (>= 1.2.7-8), libargon2-0-dev, libbz2-dev, libc-client-dev, libcurl4-openssl-dev | libcurl-dev, libdb-dev, libedit-dev (>= 2.11-20080614-4), libenchant-dev, libevent-dev (>= 1.4.11), libexpat1-dev (>= 1.95.2-2.1), libfreetype6-dev, libgcrypt20-dev (>> 1.6.3) | libgcrypt11-dev (<< 1.5.4), libgd-dev (>= 2.1.0) | libgd2-dev, libglib2.0-dev, libgmp3-dev, libicu-dev, libjpeg-dev | libjpeg62-dev, libkrb5-dev, libldap2-dev, libmagic-dev, libmcrypt-dev, libmhash-dev (>= 0.8.8), libnss-myhostname [linux-any], libonig-dev, libpam0g-dev, libpcre3-dev (>= 2:8.35), libpng-dev, libpq-dev, libpspell-dev, libqdbm-dev, librecode-dev, libsasl2-dev, libsnmp-dev, libsodium-dev, libsqlite3-dev, libssl-dev, libsystemd-dev [linux-any] | libsystemd-daemon-dev [linux-any] | base-files (<< 7.2ubuntu5~) [linux-any], libtidy-dev (>= 1:5.2.0), libtool (>= 2.2), libwebp-dev, libwrap0-dev, libxml2-dev, libxmlrpc-epi-dev, libxmltok1-dev, libxslt1-dev (>= 1.0.18), libzip-dev (>= 1.0.0), locales-all | language-pack-de, netbase, netcat-traditional, re2c, systemtap-sdt-dev [amd64 i386 powerpc armel armhf ia64], tzdata, unixodbc-dev, zlib1g-dev




執行


$ apt-cache show apache2-dev



顯示


Package: apache2-dev
Architecture: amd64
Version: 2.4.29-1ubuntu4.1
Priority: optional
Section: httpd
Source: apache2
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Apache Maintainers <debian-apache@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 984
Provides: dh-apache2
Depends: openssl, libapr1-dev, libaprutil1-dev, debhelper (>= 9), perl
Filename: pool/main/a/apache2/apache2-dev_2.4.29-1ubuntu4.1_amd64.deb
Size: 176856
MD5sum: 4aa543f155344690459745153adcea21
SHA1: 0436481aa6484b61b65a473da584a82e7008343d
SHA256: 3dc3640bc5442bcc530505843cf416c550825c881b553e590978e2786dd0b7f9
Homepage: http://httpd.apache.org/
Description-en: Apache HTTP Server (development headers)
The Apache HTTP Server Project's goal is to build a secure, efficient and
extensible HTTP server as standards-compliant open source software. The
result has long been the number one web server on the Internet.
.
This package provides development headers and the apxs2 binary for the Apache
2 HTTP server, useful to develop and link third party additions to the Debian
Apache HTTP server package.
.
It also provides dh_apache2 and dh sequence addons useful to install various
Debian Apache2 extensions with debhelper. It supports
- Apache 2 module configurations and shared objects
- Site configuration files
- Global configuration files
Description-md5: 8ba6f3b272c39cc7a08a802594285f02
Supported: 5y




執行


$ sudo apt-get build-dep php7.2



顯示


Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libminiupnpc10 xbase-clients
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  apache2-dev chrpath comerr-dev default-mysql-server dh-systemd flex krb5-multidev libaio1 libapparmor-dev libapr1 libapr1-dev libaprutil1
  libaprutil1-dev libargon2-0-dev libaspell-dev libbsd-dev libc-client2007e libc-client2007e-dev libdb-dev libdb5.3-dev libedit-dev libenchant-dev
  libevent-core-2.1-6 libevent-dev libevent-extra-2.1-6 libevent-openssl-2.1-6 libevent-pthreads-2.1-6 libgcrypt20-dev libgmp-dev libgmp3-dev
  libgmpxx4ldbl libgpg-error-dev libgssrpc4 libkadm5clnt-mit11 libkadm5srv-mit11 libkdb5-9 libkrb5-dev libldap2-dev libmagic-dev libmcrypt-dev
  libmcrypt4 libmhash-dev libonig-dev libonig4 libpam0g-dev libpci-dev libpspell-dev libqdbm-dev libqdbm14 librecode-dev librecode0 libsasl2-dev
  libsctp-dev libsctp1 libsensors4-dev libsnmp-dev libsodium-dev libsystemd-dev libtidy-dev libwebp-dev libwrap0-dev libxml2-dev libxmlrpc-epi-dev
  libxmlrpc-epi0 libxmltok1 libxmltok1-dev libxslt1-dev libzip-dev locales-all mlock mysql-client-5.7 mysql-client-core-5.7 mysql-server-5.7
  mysql-server-core-5.7 netcat-traditional re2c systemtap-sdt-dev uuid-dev
0 upgraded, 78 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.2 MB of archives.
After this operation, 361 MB of additional disk space will be used.
Do you want to continue? [Y/n] 




也可以執行下面指令研究看看


$ apt-cache showsrc libapache2-mod-php7.2 | grep '^Build-Depends:'



還有


$ sudo apt-get build-dep libapache2-mod-php7.2




若已經有安裝「libapache2-mod-php7.2」,

就可以執行下面指令,了解「libapache2-mod-php7.2」這個套件安裝那些檔案在系統上


$ dpkg -L libapache2-mod-php7.2



顯示


/.
/etc
/etc/apache2
/etc/apache2/mods-available
/etc/apache2/mods-available/php7.2.conf
/etc/apache2/mods-available/php7.2.load
/etc/php
/etc/php/7.2
/etc/php/7.2/apache2
/etc/php/7.2/apache2/conf.d
/usr
/usr/lib
/usr/lib/apache2
/usr/lib/apache2/modules
/usr/lib/apache2/modules/libphp7.2.so
/usr/lib/php
/usr/lib/php/7.2
/usr/lib/php/7.2/sapi
/usr/lib/php/7.2/sapi/apache2
/usr/share
/usr/share/bug
/usr/share/bug/libapache2-mod-php7.2
/usr/share/bug/libapache2-mod-php7.2/control
/usr/share/bug/libapache2-mod-php7.2/script
/usr/share/doc
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libapache2-mod-php7.2
/usr/share/doc/libapache2-mod-php7.2



若有安裝「apache2-dev」這個套件

可以執行下面指令


$ dpkg -L apache2-dev



顯示


/.
/usr
/usr/bin
/usr/bin/apxs
/usr/bin/dh_apache2
/usr/include
/usr/include/apache2
/usr/include/apache2/ap_compat.h
/usr/include/apache2/ap_config.h
/usr/include/apache2/ap_config_auto.h
/usr/include/apache2/ap_config_layout.h
/usr/include/apache2/ap_expr.h
/usr/include/apache2/ap_hooks.h
/usr/include/apache2/ap_listen.h
/usr/include/apache2/ap_mmn.h
/usr/include/apache2/ap_mpm.h
/usr/include/apache2/ap_provider.h
/usr/include/apache2/ap_regex.h
/usr/include/apache2/ap_regkey.h
/usr/include/apache2/ap_release.h
/usr/include/apache2/ap_slotmem.h
/usr/include/apache2/ap_socache.h
/usr/include/apache2/apache_noprobes.h
/usr/include/apache2/cache_common.h
/usr/include/apache2/heartbeat.h
/usr/include/apache2/http_config.h
/usr/include/apache2/http_connection.h
/usr/include/apache2/http_core.h
/usr/include/apache2/http_log.h
/usr/include/apache2/http_main.h
/usr/include/apache2/http_protocol.h
/usr/include/apache2/http_request.h
/usr/include/apache2/http_vhost.h
/usr/include/apache2/httpd.h
/usr/include/apache2/mod_auth.h
/usr/include/apache2/mod_cache.h
/usr/include/apache2/mod_cgi.h
/usr/include/apache2/mod_core.h
/usr/include/apache2/mod_dav.h
/usr/include/apache2/mod_dbd.h
/usr/include/apache2/mod_include.h
/usr/include/apache2/mod_log_config.h
/usr/include/apache2/mod_proxy.h
/usr/include/apache2/mod_request.h
/usr/include/apache2/mod_rewrite.h
/usr/include/apache2/mod_session.h
/usr/include/apache2/mod_so.h
/usr/include/apache2/mod_ssl.h
/usr/include/apache2/mod_status.h
/usr/include/apache2/mod_unixd.h
/usr/include/apache2/mod_watchdog.h
/usr/include/apache2/mod_xml2enc.h
/usr/include/apache2/mpm_common.h
/usr/include/apache2/os.h
/usr/include/apache2/scoreboard.h
/usr/include/apache2/unixd.h
/usr/include/apache2/util_cfgtree.h
/usr/include/apache2/util_charset.h
/usr/include/apache2/util_cookies.h
/usr/include/apache2/util_ebcdic.h
/usr/include/apache2/util_fcgi.h
/usr/include/apache2/util_filter.h
/usr/include/apache2/util_ldap.h
/usr/include/apache2/util_md5.h
/usr/include/apache2/util_mutex.h
/usr/include/apache2/util_script.h
/usr/include/apache2/util_time.h
/usr/include/apache2/util_varbuf.h
/usr/include/apache2/util_xml.h
/usr/share
/usr/share/apache2
/usr/share/apache2/build
/usr/share/apache2/build/config.nice
/usr/share/apache2/build/config_vars.mk
/usr/share/apache2/build/instdso.sh
/usr/share/apache2/build/library.mk
/usr/share/apache2/build/ltlib.mk
/usr/share/apache2/build/mkdir.sh
/usr/share/apache2/build/program.mk
/usr/share/apache2/build/rules.mk
/usr/share/apache2/build/special.mk
/usr/share/debhelper
/usr/share/debhelper/autoscripts
/usr/share/debhelper/autoscripts/postinst-apache2
/usr/share/debhelper/autoscripts/postrm-apache2
/usr/share/debhelper/autoscripts/prerm-apache2
/usr/share/doc
/usr/share/doc/apache2-dev
/usr/share/doc/apache2-dev/changelog.Debian.gz
/usr/share/doc/apache2-dev/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/apxs.1.gz
/usr/share/man/man1/dh_apache2.1.gz
/usr/share/perl5
/usr/share/perl5/Debian
/usr/share/perl5/Debian/Debhelper
/usr/share/perl5/Debian/Debhelper/Sequence
/usr/share/perl5/Debian/Debhelper/Sequence/apache2.pm
/usr/bin/apxs2
/usr/share/man/man1/apxs2.1.gz



之前有紀錄一篇「探索php套件」的討論「#56 回覆: Ubuntu 17.10 推出」,也可以參考。

另外上面我提到的指令若不能正常執行,
請參考這篇「#24 回覆: Ubuntu 17.10 推出 - 執行「apt-get source some_package」的前置作業 (下載「Source Package」的前置作業)


================================================================================


以上提供參考

報告完畢




================================================================================

[回到索引]

6/21 10:48:11
應用擴展 工具箱
回覆: 16.04 安裝 php5-oldstable失敗
會員一級
註冊日期:
6/20 18:27:44
所屬群組:
已註冊使用者
等級: 1
HP : 0 / 0
MP : 0 / 0
EXP: 2
離線
感謝您這麼熱心的回覆,您似乎一下就看出我的問題了,我再研究一下,因為php5.4是比較舊的版本,所以碰到了點問題。

再次謝謝您的幫忙。

6/21 13:22:59
應用擴展 工具箱
回覆: 16.04 安裝 php5-oldstable失敗
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 34
HP : 165 / 828
MP : 542 / 15927
EXP: 12
離線
以下先簡易紀錄我測試自行編譯成功的步驟,爾後再找時間再來修改,補充詳細說明和我發現到要注意的地方。

我測試的環境是在「Ubuntu 18.04」,目前還沒有「Ubuntu 16.04」的環境來測試。
所以以下的步驟,提供您一個參考,由您自行調整操作步驟,嘗試在「Ubuntu 16.04」編譯。

我有寫了一個簡單的專案「demo-ubuntu-php-build」放在「GitHub」上。

* Prototype
* Project

================================================================================

在我的環境已經有先安裝了「apache2」和「php7.2」。


# https://help.ubuntu.com/18.04/serverguide/httpd.html.en
sudo apt-get install apache2

# https://help.ubuntu.com/18.04/serverguide/php.html.en
sudo apt install php libapache2-mod-php



================================================================================

### prepare

執行下面指令,安裝編譯需要的工具


$ sudo apt-get install build-essential



執行下面指令,安裝編譯PHP時有可能需要的相關套件 (可以對照我在「#2」套件探索)


$ sudo apt-get build-dep libapache2-mod-php7.2



================================================================================

### download

可以到「http://php.net/releases/」這個網址,找到「5.4.45」的版本。

執行下面指令,下載「php-5.4.45.tar.bz2」。


$ wget -c 'http://php.net/get/php-5.4.45.tar.bz2/from/this/mirror' -O php-5.4.45.tar.bz2



會下載一個檔案「php-5.4.45.tar.bz2」

================================================================================

### extract

執行下面指令,解開「php-5.4.45.tar.bz2」


$ tar xf php-5.4.45.tar.bz2



會產生一個資料夾「php-5.4.45」

================================================================================

### work dir

執行下面指令,切換到資料夾「php-5.4.45」


$ cd php-5.4.45



================================================================================

### configure

參考「http://php.net/manual/en/install.unix.apache2.php」。

執行下面指令,設定編譯參數,並且產生相關的檔案


$ ./configure --with-apxs2=/usr/bin/apxs2 --prefix=/opt/php-5.4.45



上面的參數,先簡單設定,其餘的參數,請執行「./configure --help」,自行加入測試確認。

================================================================================

### build

上面若沒有出錯,就可以執行下面指令編譯。


$ make



================================================================================

### install

上面若沒有出錯,就可以執行下面指令安裝。


$ sudo make install



會安裝到「/opt/php-5.4.45」這個資料夾,
還有安裝一個檔案「/usr/lib/apache2/modules/libphp5.so」,
以及安裝一個檔案「/etc/apache2/mods-available/php5.load」。

================================================================================

### mod-install

原本的「/etc/apache2/mods-available/php5.load」檔案內容如下


LoadModule php5_module        /usr/lib/apache2/modules/libphp5.so



請修改內容如下


# Conflicts: php7.2
# Depends: mpm_prefork
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
AddType application/x-httpd-php .php



================================================================================

### mod-enable

執行下面指令,確保「mpm_prefork」是啟用的


sudo a2dismod mpm_event
sudo a2enmod mpm_prefork



執行下面指令,確保「php7.2」是關閉的


sudo a2dismod php7.2



然後執行下面指令,啟用「php5」


sudo a2enmod php5



================================================================================

### ini-development

執行下面指令,複製「php.ini-development」到「/opt/php-5.4.45/lib/php.ini」


$ sudo cp php.ini-development /opt/php-5.4.45/lib/php.ini



================================================================================

### apache-restart

執行下面指令,重新開啟「apache2」。


sudo /etc/init.d/apache2 restart
# sudo systemctl restart apache2



================================================================================

### info-install

產生一個檔案「/var/www/html/info.php」。


$ sudo vi /var/www/html/info.php



檔案內容填入如下


<?php

	phpinfo();




================================================================================

### info-view

然後在瀏覽器觀看「http://localhost/info.php」這個網址。


$ firefox http://localhost/info.php



正常的情況下,可以在頁面看到「PHP Version 5.4.45」。

================================================================================

以上提供參考

報告完畢


6/23 1:48:11
應用擴展 工具箱
回覆: 16.04 安裝 php5-oldstable失敗
會員五級
註冊日期:
2012/4/22 10:50
所屬群組:
已註冊使用者
等級: 34
HP : 165 / 828
MP : 542 / 15927
EXP: 12
離線
延續上面「#4」討論到的,在「Ubuntu 18.04」自行編譯「php-5.4.45」。

剛剛在「Virtual Box」安裝了「Xubuntu 16.04」來測試,

也紀錄了「16.04」的「操作步驟」放在「GitHub」上。

是可以編譯成功的。

請對照上面「#4」提到的操作步驟。

要在「16.04」,主要修改的地方,只要將「php7.2」改成「php7.0」,就可以了

例如:

================================================================================

### prepare

執行下面指令,安裝編譯PHP時有可能需要的相關套件 (可以對照我在「#2」套件探索)


$ sudo apt-get build-dep libapache2-mod-php7.0



================================================================================

以上提供參考

報告完畢


6/24 13:43:54
應用擴展 工具箱


 [無發表權] 請登錄或者註冊


可以查看帖子.
不可發帖.
不可回覆.
不可編輯自己的帖子.
不可刪除自己的帖子.
不可發起投票調查.
不可在投票調查中投票.
不可上傳附件.
不可不經審核直接發帖.