XamppのApacheが起動しない
非常にくだらない原因だったが、忘れないようにメモ。
久しぶりにXamppのApacheを起動しようとしたら以下の様なエラーを吐いて動かなかった。
Error: Apache shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a crash, or a shutdown by another method. Press the Logs button to view error logs and check the Windows Event Viewer for more clues If you need more help, copy and post this entire log window on the forums
エラーに従ってport番号の確認等したけれど、portは使われていない。
Apacheのerror.logにはな~んにも出てない。
試しにDOSから/xampp/apache_start.batをキックしてみたら
Diese Eingabeforderung nicht waehrend des Running beenden Bitte erst bei einem gewollten Shutdown schliessen Please close this command only for Shutdown Apache 2 is starting ... AH00526: Syntax error on line 371 of E:/xampp/apache/conf/httpd.conf: order takes one argument, 'allow,deny', 'deny,allow', or 'mutual-failure' Apache konnte nicht gestartet werden Apache could not be started
ただのSyntax error。
いつかhttpd.confの設定途中で放置していたみたい。
メッセージに従って"deny, allow"となっていたところを"deny,allow"に変更。
無事起動。
CakePHP2 + XAMPP + Netbeansでデバッグ
割りとハマったのでメモ。
新しいXAMPPにはxdebugというdllが入っているのでそれを利用。
php.iniの以下の行のコメントアウトを外す。
zend_extension = "C:\xampp\php\ext\php_xdebug.dll" xdebug.remote_enable = 0 xdebug.remote_handler = "dbgp" xdebug.remote_host = "localhost" xdebug.remote_port = 9000
xdebug.remote_enableの値を1に変える
xdebug.remote_enable = 1
apacheを再起動。
この状態でhttp://localhostにアクセスし、phpinfo()でxdebugが有効になっているか確認。
netbeansのプロジェクト->プロパティ->実行構成を開いて、
開始ファイルに"app/webroot/index.php"を設定。
次がハマったポイント。
ここまでで起動はできたが、どうしても訳の分からない行でブレークする。
理由がここに書いてあった。
http://stackoverflow.com/questions/350966/how-can-i-make-netbeans-not-stop-on-the-first-line-with-xdebug
ツール->オプション->PHP->デバッグ->最初の行で停止 のチェックを外す。
これで問題なく動きまーした。
CakePHP2プラグイン
プラグインについてのメモ。
使ってる
slywalker/cakephp-plugin-boost_cake
TwitterBootstrapを簡単に組み込めるプラグイン。
これでhttp://http://bootswatch.com/のテンプレートを突っ込んで使ってる。
fusic/filebinder
ファイルアップロード/ダウンロードを簡単に実装出来るプラグイン。
CakeDC/migrations
Railsの様なマイグレーションをCakePHPでも使えるようにするプラグイン。
入れたはいいけどマイグレーション難しくて正直つかってない。
今はデフォルトで使えるschemaで十分かな。
CakeDC/search
検索機能を実装してくれるプラグイン。ページングにも対応。
使ってみたい
CakeDC/users
ユーザ認証を実装するプラグイン。
今回はこんなにきっちりやらなくて良いので使わない。
DB項目でセレクトボックスを生成
DBから取得したデータをFormヘルパーのselectで生成する際のメモ。
controller
public function index(){ $items = $this->Item->find('list', array( 'fields' => array('id', 'name') )); $this->set('items', $items); }
view
<?php echo $this->Form->select('Item.id', $items); ?>
find('list')でテーブルの'ID'と'NAME'列を配列形式で取得し、
Formペルパーのselectに渡す。
ubuntuでcups-pdfの出力先変更
/etc/cups/cups-pdf.pdfのOutを変更すれば良いはず。
Out @{HOME}/PDF ↓ Out @{HOME}/SHARE
しかし、下記のようなエラーが発生。
[ERROR] failed to set file mode for PDF file (non fatal)
そんな時は以下を編集。
/etc/apparmor.d/usr.sbin.cupsd
@{HOME}/PDF/ w, @{HOME}/PDF/* w, ↓ /home/user/share/ w, /home/user/share/* w,
apparmorをリスタート
sudo /etc/init.d/apparmor restart
UbuntuServer12にSambaをインストールしてWindowsと共有
まずはsambaをインストール
aptitude install samba
共有したいディレクトリを作成し、権限を設定
※今回はフル権限
mkdir /home/user/share chmod 777 share
sambaの設定
vim /etc/samba/smb.conf
最終行に共有ディレクトリの指定
[share] path = /home/user/share writable = yes guest ok = yes guest only = yes create mode = 0777 directory mode = 0777 share modes = yes
samba再起動
service smbd restart
sambaの設定に関しては、smb.confの記述次第でもっと細かい制御が出来る。