Error message

  • Deprecated function: Creation of dynamic property SelectQuery::$alterTags is deprecated in SelectQuery->addTag() (line 978 of /var/www/cms/drupal7/includes/database/select.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property SelectQuery::$alterTags is deprecated in SelectQuery->addTag() (line 978 of /var/www/cms/drupal7/includes/database/select.inc).
  • Deprecated function: Creation of dynamic property SelectQuery::$alterTags is deprecated in SelectQuery->addTag() (line 978 of /var/www/cms/drupal7/includes/database/select.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property SelectQuery::$alterTags is deprecated in SelectQuery->addTag() (line 978 of /var/www/cms/drupal7/includes/database/select.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property SelectQuery::$alterTags is deprecated in SelectQuery->addTag() (line 978 of /var/www/cms/drupal7/includes/database/select.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property SelectQuery::$alterTags is deprecated in SelectQuery->addTag() (line 978 of /var/www/cms/drupal7/includes/database/select.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property SelectQuery::$alterTags is deprecated in SelectQuery->addTag() (line 978 of /var/www/cms/drupal7/includes/database/select.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property SelectQuery::$alterTags is deprecated in SelectQuery->addTag() (line 978 of /var/www/cms/drupal7/includes/database/select.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).
  • Deprecated function: Creation of dynamic property DatabaseCondition::$stringVersion is deprecated in DatabaseCondition->compile() (line 1887 of /var/www/cms/drupal7/includes/database/query.inc).

Drupal 導入記(Mac で試験環境を構築)

使用環境

MacBook Pro 15, Retina
MacOS X 10.9.1 

Web Server の起動

10.9 Mavericks では、システム環境設定(共有)から、Web Server (Apache2) の起動/停止/再起動ができなくなったので、ターミナルからコマンドラインで行う必要がある。そこで
 
$ sudo apachectl start     # httpd 起動
$ sudo apachectl restart   # httpd 再起動
$ sudo apachectl stop      # httpd 停止
 
などとする。Mac の起動時に自動的に Web Server (Apache2) の起動がしたければ、
 
$ sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
 
などとする。
 

php の有効化

安全上の理由であろうが、デフォールトでは、php は使えない設定になっている。そこで、httpd.conf を編集して、php を有効化する。

$ sudo cp -p /etc/apache2/httpd.conf /etc/apache2/httpd.conf.orig
$ sudo vi /etc/apache2/httpd.conf
......
LoadModule php5_module libexec/apache2/libphp5.so
......
$ sudo apachectl configtest
$ sudo apachectl restart
 
ここで、configtest の行は、httpd.conf を編集した際に、文法エラーがないことを確かめるため。
 

MySQL のインストールと設定(Drupal 用)

MySQL は、HEPonX 提供版を使う(HEPonX がインストールされていることが前提)。

$ sudo apt-get updatet
$ sudo apt-get install mysql-server mysql mysql-libs
$ sudo mysqld_safe &
 
 
これで、mysql server が起動される。次に、mysql のアカウントを作る。
 
$ mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'localhost' IDENTIFIED BY '[passwd]' WITH GRANT OPTION;
....
mysql> FLUSH PRIVILEGES;
mysql> exit
 
 
次に、drupal 用の database 'DRUPALDB' を作ります。
 
$ mysql -u mysql -p -e "create database DRUPALDB;"

 

これで、drupal のインストールの準備ができたが、その前に、SSL を使うために必要となるので、php と mysql の通信設定をしておく。

$ cd /etc
$ sudo cp -p php.ini.default php.ini
$ sudo vi php.ini
.......
; date.timezone =
date.timezone = Asia/Tokyo
.......
; pdo_mysql.default_socket=
pdo_mysql.default_socket=/var/lib/mysql/mysql.sock
....... 
; mysql.default_socket=
mysql.default_socket=/var/lib/mysql/mysql.sock
....... 
; mysqli.default_socket=
mysqli.default_socket=/var/lib/mysql/mysql.sock
....... 
$ sudo apachectl restart
 

SSL の有効化

まず、個人用の証明書を作る。

$ sudo mkdir /etc/apache2/ssl 
$ cd ssl
$ sudo ssh-keygen -f server.key
$ sudo openssl req -new -key server.key -out req.csr
......
Common Name (e.g. server FQDN or YOUR name) []:localhost
......
後は適当に答える
......
$ sudo openssl x509 -req -days 365 -in req.csr -signkey server.key -out server.crt
$ cd ..
$ sudo vi httpd.conf
......
Include /private/etc/apache2/extra/httpd-ssl.conf
......
$ cd extra
$ cp -p httpd-ssl.conf httpd-ssl.conf.orig
$ vi httpd-ssl.conf
......
SSLCertificateFile "/private/etc/apache2/ssl/server.crt"
......
SSLCertificateKeyFile "/private/etc/apache2/ssl/server.key"
......
$ sudo apachectl configtest
$ sudo apachectl restart

個人ページの有効化

個人(hogehoge さん)用のホームページ作成を許すため、個人毎に個人用のホームページ設定をする。

$ cd /etc/apache2/users
$ sudo vi hogehoge.conf
......
<Directory "/Users/hogehoge/Sites/">
  AlowOverride All
  Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec ExecCGI
  AddHandler cgi-script .cgi
  <Limit GET POST OPTIONS PROPFIND>
    Order allow,deny
    Allow from all
  </Limit>
  <LimitExcept GET POST OPTIONS PROPFIND>
    Order deny,allow
    Deny from all
  </LimitExcept>
</Directory>
$ sudo apachectl restart
 
これで hogehoge さんのホームページに "http://localhost/~hogehoge" のようにアクセスできるようになる。この場合、個人用ホームページとトップ・ディレクトリーは、/Users/hogehoge/Sites/ である。ちなみに "localhost" のトップディレクトリーは、/Library/WebServer/Documents/ だ。

.htaccess の有効化

Mac では、デフォールトでは、.htacces による override を禁止している。.htacces の有効化は、後に drupal で、Cean URL 設定を行うために必要になる。以下のような記述を /etc/apache2/httpd.conf の最後に追加する。ちなみに、drupal のインストール場所は、 /Library/Documents/drupal と仮定している。

$ sudo vi /etc/apache2/httpd.conf
......
<Directory /Library/WebServer/Documents/drupal>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>
$ sudo apachectl restart
 
これで durupal インストールの準備完了。

Drupal のインストール

基本的には、ここに書いたことを踏襲する。

$ cd /Library/WebServer/Documents/
$ sudo tar -zxvf <somewhere>/drupal-7.24.tar.gz
$ sudo mv drupal-7.24 drupal
$ pushd drupal/sites/default
$ sudo cp default.settings.php settings.php
$ popd
$ sudo chown -R _www:_www drupal
......
質問に答える。hostname の所は、"localhost" でなく "127.0.0.1" でないとだめだった。
......
 
これで一応インストール完了だが、セキュリティ対策をしておく。
 
$ pushd drupal/sites/
$ sudo chmod a-w default
$ cd default
$ sudo chmod 600 settings.php
$ sudo rm -f default.settings.php
$ sudo cp <somewhere>/dot.htaccess /tmp/.htaccess
$ sudo cp <somewhere>/dot.htaccess files/.htaccess
 
ここで、<somewhere>/dot.htaccess の中身については、ここを見ること。これで終わり。
 
 

Subgroup: