LoginSignup
7
4

More than 5 years have passed since last update.

php5.6.0のインストール

Posted at

環境
OS:Ubuntu14.04
DB:MariaDB 10.0.11 InnoDB、 PostgreSQL 9.3.5
Apache:2.4.10
thinkpad T440p

php本体と、apacheやdatabase用の拡張モジュールを適当に入れてみる

インストール

sourceをダウンロード
http://php.net/downloads.php
展開(~/work/php-5.6.0$)

~/work/php-5.6.0$ ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd --with-pdo-pgsql --with-pgsql

configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

怒られた。PostgreSQLを標準と違う場所に入れていたため。

~/work/php-5.6.0$ ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd --with-pdo-pgsql=/home/k/pgsql_work --with-pgsql=/home/user/pgsql_work

PostgreSQLをインストールしたディレクトリを指定していると上手く行く。後は
make
make test
sudo make install

Apacheの設定

httpd.confを編集してモジュールをロードするようにする

httpd.conf
#コメントアウトされていたら外す
LoadModule php5_module        modules/libphp5.so

#なければ追加、.phpファイルをphpファイルとしてパース出来るようにする
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

確認

documentrootの下にphpinfo.phpをおいて確認
DocumentRootはhttpd.confに書いてある("/usr/local/apache2/htdocs"とか自分で好き勝手設定する)

phpinfo.php
<?php
phpinfo();

~$ apache_start
http://localhost:8080/phpinfo.php
にアクセス

5.6のバージョンが見れたらOK

phpで有効になっているモジュールの確認

php -m
・・・
mysql
mysqli
mysqlnd
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
・・・

7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4