1

次を実行するための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));
}
4

7 に答える 7

4

コメントだけを書きたいのですが、できませんでした.... 私はここに来たばかりで、質問にコメントを追加するオプションがありません。

ええと...私は1年前に専用サーバーで同じ問題を抱えていました。

解決策は、 $system_path を空白のままにすることでした...

$system_path = '';

代わりにこれを試すことができます:

$system_path = './system';
于 2012-05-17T05:14:50.723 に答える
3

問題は権限に関連していました。私はこれについて考えたことはありませんでしたが、ルートとしてログインしている場合にgithubからプルすると、所有権は明らかにroot. その結果、php は正しく実行できません。

私は走った:chown exampleuser:psacln index.phpそして今はすべて順調です!

したがって、この問題に直面している他の人への教訓として..同じ問題が発生している場合は、所有権とファイルのアクセス許可が正しいことを確認してください!

于 2012-05-17T14:14:22.853 に答える
0
/*
 *---------------------------------------------------------------
 * 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';

/*
 *---------------------------------------------------------------
 * APPLICATION FOLDER NAME
 *---------------------------------------------------------------
 *
 * If you want this front controller to use a different "application"
 * folder then the default one you can set its name here. The folder
 * can also be renamed or relocated anywhere on your server.  If
 * you do, use a full server path. For more info please see the user guide:
 * http://codeigniter.com/user_guide/general/managing_apps.html
 *
 * NO TRAILING SLASH!
 *
 */
    $application_folder = '../application';

別の../を追加しない場合は、この仲間を試すことができます

パスが正しく設定されていれば、間違いなくエラー報告はそうは言いません:)

ただ助けます^_^これがそうであることを願っています

于 2012-05-17T05:03:28.457 に答える
0

index.php で

私はこれらの変更を行い、私のために働きました。

$system_path = '../system/';

$application_folder = '../application/';
于 2014-10-17T10:03:39.530 に答える
0

FTP転送で何も問題がなかったと確信していますか? つまり、システムは実際には index.php と同じディレクトリにありますか?

また、正しい場所から php を呼び出していますか? パスは正しいですか?

私は最近この問題を抱えていました: CodeIgniter + コマンドライン + Cron + Cpanel

実行してみてください:

/usr/local/bin/php your/path/to/index.php <controller> <method>

パスについては、おそらくフルパスである必要がありますか?www.example.com/index.php ではありませんか? つまり、私のものは次のようなものです:

/usr/local/bin/php /home/account_name/public_html/index.php <controller> <method> /dev/null 2>&1
于 2012-05-17T10:11:50.380 に答える
0

すべてのディレクトリを 755 (-rwxr-xr-x) に変更するには:

find /opt/lampp/htdocs -type d -exec chmod 755 {} \;

すべてのファイルを 644 (-rw-r--r--) に変更するには:

find /opt/lampp/htdocs -type f -exec chmod 644 {} \;

codeigniter 3.0.0 配布 plz を修正してください!

于 2015-07-09T08:06:32.063 に答える