環境構築の記事でよく目にすると思いますが
このsudoコマンド。
気になってて調べてみたんです。
sudo is a Terminal command used to execute a command as another user, by default, the root user.
あるコマンドを別のユーザとして実行する、デフォルトではルートユーザ、だそうです。
例えばルートユーザとしてあるアプリを実行したい時は:
sudo open ....
環境構築の記事でよく目にすると思いますが
このsudoコマンド。
気になってて調べてみたんです。
sudo is a Terminal command used to execute a command as another user, by default, the root user.
あるコマンドを別のユーザとして実行する、デフォルトではルートユーザ、だそうです。
例えばルートユーザとしてあるアプリを実行したい時は:
sudo open ....
http://wiki.github.com/MrAnchovy/kohana-module-smarty/
githubでも手順がとても分かりやすいので直接引用させていただきます。
1. Download the latest version from the links above
2. Unpack the downloaded file
3. Move the smarty directory into the Kohana modules directory
4. Enable the module in your application’s bootstrap.php
Kohana::modules(array(
‘auth’ => MODPATH.‘auth’, // Basic authentication
// ‘cache’ => MODPATH.‘cache’, // Caching with multiple backends
// ‘codebench’ => MODPATH.‘codebench’, // Benchmarking tool
‘database’ => MODPATH.‘database’, // Database access
// ‘image’ => MODPATH.‘image’, // Image manipulation
‘orm’ => MODPATH.‘orm’, // Object Relationship Mapping
‘pagination’ => MODPATH.‘pagination’, // Paging of results
‘userguide’ => MODPATH.‘userguide’, // User guide and API documentation
‘smarty’ => MODPATH.’smarty’, // smarty template module.
));
5. Visit the page www.yoursite.com/smarty to confirm all is OK
このモジュールのファイル構造: http://github.com/MrAnchovy/kohana-module-smarty/wiki/file-structure
Smartyのインストールはphp.iniにインクルードパスを書く方法と書かない方法があります。ここではphpのインクルードパスに書く方法を紹介します。
http://www.smarty.net/download.phpからダウンロードします。今回は3.0rc3にしました。
できたフォルダ名はSmarty-3.0rc3で、それをsmartyにリネームして、/Applications/XAMPP/xamppfiles/lib/phpに移動します。こうするのはここがXAMPPの場合のinclude_pathになるからです。
php.ini中のinclude_pathに”.:/Applications/XAMPP/xamppfiles/lib/php/smarty/libs”の記述を追加します。
できたイメージはこうなります。
include_path=".:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear.:/Applications/XAMPP/xamppfiles/lib/php/smarty/libs"
smartyは四つのフォルダが必要です:
templates_cとcacheフォルダには適切な書き込み権限を付与しなければなりません。
場所は任意のはずです。ここではこんな形にしました。htdocsはXAMPPのウェブルートフォルダです。
上記templatesフォルダにsmarty.tplというファイルを作成します。
<html>
<body>
Hello, {$name}!
</body>
</html>
/Applications/XAMPP/xamppfiles/htdocs/にsmarty.phpというファイルを作成します。
<?php
// load Smarty library
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = '/Applications/XAMPP/xamppfiles/htdocs/smarty/templates';
$smarty->config_dir = ' /Applications/XAMPP/xamppfiles/htdocs/smarty/config';
$smarty->cache_dir = '/Users/zolo/Develop/smarty/cache';
$smarty->compile_dir = '/Users/zolo/Develop/smarty/templates_c';
$smarty->assign('name','kinopyo!');
$smarty->display('smarty.tpl');
?>
php.iniを編集したため、まずはapacheを再起動します。
そしてhttp://127.0.0.1/smarty.phpにアクセスしてエラーがなければOKです。
memcacheとphp_memcache extensionがインストールされたこと。
Mac XAMPP環境でmemcacheとPHP extensionのインストール | Kinopyo Blogを参考してください。
Kohana::modulesのcacheのコメントを外します。
場所はapplication/configでもいいしsystem/config、modules/configでもいいです。
<?php defined('SYSPATH') or die('No direct script access.');
return array
(
'default' => array
(
'driver' => 'memcache',
'default_expire' => 3600,
// Use Zlib compression (can cause issues with integers)
'compression' => FALSE,
'servers' => array
(
array
(
// Memcache Server
'host' => '127.0.0.1',
// Memcache port number
'port' => 11211,
// Persistent connection
'persistent' => FALSE,
),
),
),
);
まずはmemcacheを立ち上がってください。(ターミナルでmemcached -m 8 -l 127.0.0.1 -p 11211 -d )
そしてbootstrap.phpの最後にテスト用のコードを追記します。
$cache = Cache::instance();
$cache->set('hello','world');
die(var_dump($cache->get('hello')));
これで任意のページを開いて下記の内容が表示されれば成功ってことです。
string(5) “world”
テスト成功したらbootstrap.phpからテスト用のコードを削除してください。
http://www.apachefriends.org/en/xampp-macosx.htmlより下記赤線のリンクをダウンロードします。
参考リンク:http://blog.m-schmidt.eu/2010/03/30/develop-memcached-web-apps-with-xampp-under-mac-os-x/
ダウンロードしたdmgファイルを開いてDevel-Package.mpkgをダブルクリックでインストールします。
cd /tmp pecl download memcache tar xzf memcache-2.2.5.tgz cd memcache-2.2.5 /Applications/XAMPP/xamppfiles/bin/phpize-5.3.1 MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.1 make sudo make install
成功したら/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-xxxxのフォルダ(xxは20090626みたいな日付)にmemcache.soというファイルが生成されます。
/Applications/XAMPP/xamppfiles/etc/php.iniファイルを開いて”Dynamic Extensions”のブロックを検索し、下記内容を追記します。私の環境では538行くらいでした。
extension=memcache.so
こんあ感じです。
ターミナルで下記コマンドを実行します。
memcached -m 8 -l 127.0.0.1 -p 11211 -d
これは自分の環境でmemcacheをIP:127.0.0.1、ポート:11211、8MBのRAMスペースで立ち上がる意味です。
下記ファイルを用意します。ファイル名は任意です(ここではmemcache.phpとしました)。
<?php
$memcache = memcache_connect('127.0.0.1', 11211);
if ($memcache) {
$memcache->set("str_key", "String to store in memcached");
$memcache->set("num_key", 123);
$object = new StdClass;
$object->attribute = 'test';
$memcache->set("obj_key", $object);
$array = Array('assoc'=>123, 345, 567);
$memcache->set("arr_key", $array);
var_dump($memcache->get('str_key'));
var_dump($memcache->get('num_key'));
var_dump($memcache->get('obj_key'));
}
else {
echo "Connection to memcached failed";
}
?>
これを/Applications/XAMPP/xamppfiles/htdocsに置いて、ブラウザでhttp://localhost/memcache.php(あるいはhttp://127.0.0.1/memcache.php)を開きます。
下記のようなページが表示されればOKです。
ちなみにmemcacheを停止するコマンドは:
killall memcached
![]()
コンテキストメニューであらゆるコマンドが実行できる。
![]()
リポジトリチェックアウト.
ダウンロードしたらApplicationフォルダからアイコンをFinderのツールバーにドラッグしてね。
参考サイト:
申し訳ありません、このコンテンツはただ今 English のみです。
EclipseにMavenのプラグインをインストールした後にEclipseを起動したら以下のエラーメッセージが出ました。
The Maven Integration required that Eclipse be running in a JDK, because a number of Maven core plugins are using jars from the JDK. Please make sure the -vm option in eclipse.ini is pointing to a JDK and verify that Installed JREs are also using JDK installs.
使ってた環境は確かにJREのみがあってJDKはなかったんです。
回避策としては
JDKのダウンロードはこちら:Sun Java
インストール後JAVA_HOMEとPATH環境変数もあわせて編集
エクスプローラ→マイコンピュータ→右クリック→プロパティ→詳細設定タブ→環境変数ボタン
jdkのパスはインストール先に合わせて下記内容を追記
vmの後に改行が必要
-vm C:\Java\jdk1.6.0_18\bin\javaw.exe
これで再起動したらエラーメッセージは出なくなりました。
現時点の最新版はtomcatPluginV321.zipです。
私の場合デフォルトがJRE1.4になっていたため、これを1.5の変えました。
Tomcat公式サイトダウンロードページで上記ファイルをダウンロード
ただ適当な場所に解凍するだけです。
ターミナルを起動しTOMCAT/binに移動する
“./”は必須です。
ターミナルで使われるUNIXコマンドはイマイチなので、もっと便利な使い方はあると思います。