mac の開発環境構築 〜PHP バージョン変更〜

趣旨

前回インストールしたPHP5.3.3では、cakePHPやCMSなどまだまだ対応できていないものが多く、開発には何かと不便。
と、いうことで、PHP5.2系を入れ直すことに。

まずは、前回インストールしたPHP5.3.3をアンインストール。
それからPHP5.2系をインストールしていきます。

まずは、前回インストールしたPHP5.3.3をアンインストール。

既にインストールされているPHPを確認。

$ port installed php5
The following ports are currently installed:
  php5 @5.3.3_2+apache2+pear (active)

関連するpackageも同時にuninstall

$ sudo port uninstall -f php5
Password:
--->  Unable to uninstall/deactivate php5 @5.3.3_2+apache2+pear, the following ports depend on it:
--->  	php5-curl @5.3.3_0
--->  	php5-gd @5.3.3_0
--->  	php5-mbstring @5.3.3_0
--->  	php5-mcrypt @5.3.3_0
--->  	php5-mysql @5.3.3_0+mysqlnd
--->  	php5-sqlite @5.3.3_0
--->  	php5-tidy @5.3.3_0
--->  	php5-zip @5.3.3_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Deactivating php5 @5.3.3_2+apache2+pear
--->  Unable to uninstall/deactivate php5 @5.3.3_2+apache2+pear, the following ports depend on it:
--->  	php5-curl @5.3.3_0
--->  	php5-gd @5.3.3_0
--->  	php5-mbstring @5.3.3_0
--->  	php5-mcrypt @5.3.3_0
--->  	php5-mysql @5.3.3_0+mysqlnd
--->  	php5-sqlite @5.3.3_0
--->  	php5-tidy @5.3.3_0
--->  	php5-zip @5.3.3_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Cleaning php5
--->  Uninstalling php5 @5.3.3_2+apache2+pear
--->  Cleaning php5

Warningエラーがでてるけど、uninstallされたみたい。

念のため、clean

$ sudo port clean php5
--->  Cleaning php5

次にPHP5.2系をインストールしていきます。

まずは、macportのupdate

$ sudo port -d selfupdate
$ sudo port -d sync

PHP5.2を検索

$ port search php5
php5 @5.3.3 (lang, php, www)
    PHP: Hypertext Preprocessor
・・・
php52 @5.2.14 (lang, php, www)
    PHP: Hypertext Preprocessor
・・・

variants を確認

$ port variants php52
php52 has the variants:
   apache: Add Apache 1 web server module
     * conflicts with apache2 no_web
[+]apache2: Add Apache 2.2 web server module
     * conflicts with apache no_web
   dbase: Add dBase file format support
   debug: Enable debug support (useful to analyze a PHP-related core dump)
   fastcgi: Add FastCGI web server binary
     * conflicts with no_web
   gmp: Add GNU MP multiprocessing functions
   imap: Add IMAP protocol support
   ipc: Add semaphore, shared memory and IPC functions
   macports_snmp: Add SNMP support using MacPorts SNMP
     * conflicts with snmp
   mssql: Add MS-SQL server support
   mysql4: Add MySQL 4 support
     * conflicts with mysql5
   mysql5: Add MySQL 5 support
     * conflicts with mysql4
   no_web: Don't include any web server support
     * conflicts with apache apache2 fastcgi
   oracle: Add Oracle oci8 database functions with the Oracle Instant Client
   pcntl: Add process control functions
   pear: Add PEAR
   postgresql82: Add PostgreSQL 8.2 support
     * conflicts with postgresql83 postgresql84
   postgresql83: Add PostgreSQL 8.3 support
     * conflicts with postgresql82 postgresql84
   postgresql84: Add PostgreSQL 8.4 support
     * conflicts with postgresql82 postgresql83
   pspell: Add pspell spell-checking functions
   readline: Add GNU readline functions
   snmp: Add SNMP support using Apple SNMP
     * conflicts with macports_snmp
   sockets: Add socket communication functions
   sqlite: Add SQLite support
   suhosin: Add Suhosin patch
   t1lib: Add PostScript Type 1 font support with t1lib
   tidy: Add Tidy support
   universal: Build for multiple architectures

5.3系では「Obsolete」になっていたものも5.2系ではいけるみたい。

$ sudo port install php52 +apache2 +pear +mysql5 +sqlite +tidy
--->  Computing dependencies for mysql5
--->  Fetching mysql5
--->  Attempting to fetch mysql-5.1.52.tar.gz from http://mirror.facebook.net/mysql/Downloads/MySQL-5.1/
--->  Verifying checksum(s) for mysql5
--->  Extracting mysql5
--->  Applying patches to mysql5
--->  Configuring mysql5
--->  Building mysql5
--->  Staging mysql5 into destroot
--->  Computing dependencies for mysql5
--->  Installing mysql5 @5.1.52_0
--->  Deactivating mysql5 @5.1.51_0
--->  Cleaning mysql5
--->  Activating mysql5 @5.1.52_0
--->  Cleaning mysql5
--->  Computing dependencies for php52
Error: Unable to execute port: Can't install php52 because conflicting ports are installed: php5-gd php5-mbstring php5-sqlite
To report a bug, see <http://guide.macports.org/#project.tickets>

わぁ。エラーでちゃった。PHP5.3.3のとき、あとから入れたモジュールが邪魔してるみたい。

「-f」オプションをつけてもこれらはuninstallされないのね。一個ずつ削除します。。

おまけにmysql5がインストールされているみたい。

そいえば、「mysql5-server」はいれたけど「mysql5」は入れなかったなぁ。

$ sudo port uninstall -f php5-sqlite
Password:
--->  Deactivating php5-sqlite @5.3.3_0
--->  Cleaning php5-sqlite
--->  Uninstalling php5-sqlite @5.3.3_0
--->  Cleaning php5-sqlite
$ sudo port uninstall -f php5-mysql
--->  Unable to uninstall/deactivate php5-mysql @5.3.3_0+mysqlnd, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Deactivating php5-mysql @5.3.3_0+mysqlnd
--->  Unable to uninstall/deactivate php5-mysql @5.3.3_0+mysqlnd, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Cleaning php5-mysql
--->  Uninstalling php5-mysql @5.3.3_0+mysqlnd
--->  Cleaning php5-mysql
$ sudo port uninstall -f php5-mbstring
--->  Unable to uninstall/deactivate php5-mbstring @5.3.3_0, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Deactivating php5-mbstring @5.3.3_0
--->  Unable to uninstall/deactivate php5-mbstring @5.3.3_0, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Cleaning php5-mbstring
--->  Uninstalling php5-mbstring @5.3.3_0
--->  Cleaning php5-mbstring
$ sudo port uninstall -f php5-curl
--->  Deactivating php5-curl @5.3.3_0
--->  Cleaning php5-curl
--->  Uninstalling php5-curl @5.3.3_0
--->  Cleaning php5-curl
$ sudo port uninstall -f php5-gd
--->  Unable to uninstall/deactivate php5-gd @5.3.3_0, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Deactivating php5-gd @5.3.3_0
--->  Unable to uninstall/deactivate php5-gd @5.3.3_0, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Cleaning php5-gd
--->  Uninstalling php5-gd @5.3.3_0
--->  Cleaning php5-gd
$ sudo port uninstall -f php5-tidy
--->  Deactivating php5-tidy @5.3.3_0
--->  Cleaning php5-tidy
--->  Uninstalling php5-tidy @5.3.3_0
--->  Cleaning php5-tidy
$ sudo port uninstall -f php5-mcrypt
--->  Unable to uninstall/deactivate php5-mcrypt @5.3.3_0, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Deactivating php5-mcrypt @5.3.3_0
--->  Unable to uninstall/deactivate php5-mcrypt @5.3.3_0, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Cleaning php5-mcrypt
--->  Uninstalling php5-mcrypt @5.3.3_0
--->  Cleaning php5-mcrypt
$ sudo port uninstall -f php5-zip
--->  Unable to uninstall/deactivate php5-zip @5.3.3_0, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Deactivating php5-zip @5.3.3_0
--->  Unable to uninstall/deactivate php5-zip @5.3.3_0, the following ports depend on it:
--->  	phpmyadmin @3.3.5.1_0
Warning: Uninstall/deactivate forced.  Proceeding despite dependencies.
--->  Cleaning php5-zip
--->  Uninstalling php5-zip @5.3.3_0
--->  Cleaning php5-zip

ログをちゃんととってると、こんなとき楽だね。

あいかわらず、Warningは出てるけど、小さなことは気にしない!

では、もいちどinstall

$ sudo port install php52 +apache2 +pear +mysql5 +sqlite +tidy
--->  Computing dependencies for php52
--->  Dependencies to be installed: libxslt tiff
--->  Fetching libxslt
--->  Attempting to fetch libxslt-1.1.26.tar.gz from http://distfiles.macports.org/libxslt
--->  Verifying checksum(s) for libxslt
--->  Extracting libxslt
--->  Configuring libxslt
--->  Building libxslt
--->  Staging libxslt into destroot
--->  Installing libxslt @1.1.26_0
--->  Activating libxslt @1.1.26_0
--->  Cleaning libxslt
--->  Fetching tiff
--->  Attempting to fetch tiff-3.9.4.tar.gz from ftp://ftp.jp.FreeBSD.org/pub/FreeBSD/ports/distfiles/
--->  Verifying checksum(s) for tiff
--->  Extracting tiff
--->  Configuring tiff
--->  Building tiff
--->  Staging tiff into destroot
--->  Installing tiff @3.9.4_0
--->  Activating tiff @3.9.4_0
--->  Cleaning tiff
--->  Fetching php52
--->  Attempting to fetch php-5.2.14.tar.bz2 from http://distfiles.macports.org/php5
--->  Verifying checksum(s) for php52
--->  Extracting php52
--->  Applying patches to php52
--->  Configuring php52
--->  Building php52
--->  Staging php52 into destroot
Error: Target org.macports.destroot returned: shell command failed (see log for details)
Log for php52 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_php52/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>

またエラーが・・・。

だめだ。。。バグチケットを投げてね。っていわれるんだけど、英語だし...

とりあえず、5.3.3系をも一度入れ直しておくことに。

$ sudo port install php5 +apache2 +pear
--->  Computing dependencies for php5
--->  Fetching php5
--->  Verifying checksum(s) for php5
--->  Extracting php5
--->  Applying patches to php5
--->  Configuring php5
--->  Building php5
--->  Staging php5 into destroot
Note: php5 installs files outside the common directory structure.
--->  Installing php5 @5.3.3_2+apache2+pear
--->  Activating php5 @5.3.3_2+apache2+pear
You may need to update your php.ini for any changes that have been made
in this version of php. Compare /opt/local/etc/php5/php.ini with
/opt/local/etc/php5/php.ini-development (if this is a development server) or
/opt/local/etc/php5/php.ini-production (if this is a production server).

If this is your first install, you need to activate PHP in your web server.

To enable PHP in Apache, run
  cd /opt/local/apache2/modules
  /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
--->  Cleaning php5

投稿日:

ページのトップへ戻る