次を実行するためのcronタスク設定があります。
php /var/www/vhosts/examplesite.com/index.php cron processCategoryItemCount
これを本番サーバー(MediaTemple dv4を介してホストされている)で実行すると、sshウィンドウで次のエラーが点滅します。
システムフォルダのパスが正しく設定されていないようです。次のファイルを開いて修正してください:index.php
開発用MacでphpCLIコマンドを実行しても、エラーはまったく発生しません。
system_pathが正しく設定されていることがわかる限り、ここにスニペットがあります。
/*
*---------------------------------------------------------------
* SYSTEM FOLDER NAME
*---------------------------------------------------------------
*
* This variable must contain the name of your "system" folder.
* Include the path if the folder is not in the same directory
* as this file.
*
*/
$system_path = 'system';
手動テスト
CIが決定するために使用するコードを調べるためにいくつかのテストをsystem_path
行いapplication_path
ました。私がそれが正しく機能していると言うことができることから。
CodeIgniterはパス検証に次のコードを使用します
// Set the current directory correctly for CLI requests
if (defined('STDIN'))
{
chdir(dirname(__FILE__));
}
if (realpath($system_path) !== FALSE)
{
$system_path = realpath($system_path).'/';
}
// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';
// Is the system path correct?
if ( ! is_dir($system_path))
{
exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}
その結果、test.phpファイルを作成し、httprootに貼り付けました。
<?php
$system_path = 'system';
echo "index.php dir is: ".dirname(__FILE__)."\n";
chdir(dirname(__FILE__));
echo "System Dir is: ".realpath($system_path)."\n";
if ( ! is_dir($system_path)){
exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}else{
echo "System Path Set Properly\n";
}
sleep(30);
私はこのコマンドでコマンドラインを介してこれを実行しました:
/usr/bin/php /var/www/vhosts/examplesite.com/client/stage/test.php`
これは私が返すものです:
index.php dir is: /var/www/vhosts/examplesite.com/client/stage
System Dir is: /var/www/vhosts/examplesite.com/client/stage/system
System Path Set Properly
だから、もう少しテストして、問題がこの部分にあることを発見しました:
if ( ! is_dir($system_path))
{
exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
}