Ubuntu14.04以降であればPHP用のパッケージリポジトリを追加するだけでlibapache2-mod-phpをインストールできましたが、12.04ではインストールできませんでした。apacheをubuntu標準のものから置き換えることでインストールできました。(apache2.2⇒apache2.4)
※「この度、VPSをレンタルして」ということなのにOSがUbuntu12.04なのは何か理由があってのことでしょうか?新しくインストールする環境であれば16.04か14.04で問題なさそうな気がしますが。
【手順】
パッケージリポジトリを追加する。(PHPとapache用)
sh
1$ sudo apt-get update
2$ sudo apt-get install python-software-properties software-properties-common
3$ sudo apt-add-repository ppa:ptn107/apache
4$ sudo add-apt-repository ppa:ondrej/php
5$ sudo apt-get update
インストール済みのapache2を削除する。
sh
1$ sudo apt-get purge 'apache2*'
2$ sudo apt-get autoremove
PHP用のapache2モジュールをインストールする。
sh
1$ sudo apt-get install libapache2-mod-php
【補足】
ubuntu12.04オリジナルのapacheのままだとlibapache2-mod-phpが失敗します。
sh
1$ apt-get update
2$ apt-get install python-software-properties software-properties-common
3$ add-apt-repository ppa:ondrej/php
4$ apt-get update
5$ apt-get install libapache2-mod-php
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libapache2-mod-php : Depends: libapache2-mod-php7.1 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
依存パッケージのlibapache2-mod-php7.1をインストール(失敗原因確認)
sh
1$ apt-get install libapache2-mod-php7.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libapache2-mod-php7.1 : Depends: apache2-api-20120211 but it is not installable
Recommends: apache2
E: Unable to correct problems, you have held broken packages.
apache2をインストールしてlibapache2-mod-php7.1をインストール
sh
1$ apt-get install apache2
2$ apt-get install libapache2-mod-php7.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libapache2-mod-php7.1 : Depends: apache2-api-20120211 but it is not installable
E: Unable to correct problems, you have held broken packages.
⇒Recommendが消えただけ
依存パッケージのapache2-api-20120211をインストール(失敗原因確認)
sh
1$ apt-get install apache2-api-20120211
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package apache2-api-20120211 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'apache2-api-20120211' has no installation candidate
パッケージなかとです・・・。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/02/12 15:42
2017/02/12 16:51
2017/02/14 12:42
2017/02/19 13:54