-1
對不起,我的英語。我在尋找大約2天沒有答案。 問題是:如何從godaddy運行一個控制檯與codeigniter的PHP命令
我需要運行cron作業。我在控制檯寫在godaddy的SSH這樣的:
/網絡/ cgi-bin目錄/ PHP5 /path/to/my/project/html/www/myproject/index.php crons測試
和我得到:
Status: 301 Moved Permanently
Location: http://www.
Content-type: text/html
我有... /應用/控制器,它有這樣的代碼文件crons.php:
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Crons extends MY_Controller {
public function __construct() {
parent::__construct();
}
public function test() {
echo "hello word";
}
}
/* End of file crons.php */
/* Location: ./application/controllers/crons.php */
這是要我的index.php,但它不是,因爲我的工作index.php我有這個代碼重定向.mysit E要www.mysite,和$ getsite_all是錯誤:
$getsite_all = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$getsite = $_SERVER['HTTP_HOST'];
$getsite = str_replace($e_dom, '', $getsite);
$ugetsite = explode('.', $getsite);
if ($ugetsite[0] != 'www') {
$estimated_url = 'http://www.' . $getsite_all;
header('HTTP/1.1 301 Moved Permanently');
header("Location: $estimated_url");
die();
}
,但如果我刪除此行的錯誤是從該行:
// 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));
}
所以我認爲錯誤可能來自我的.htaccess是:
<FilesMatch "\.(css|js|gif|jpe?g|png|ico)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
</FilesMatch>
FileETag none
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
# Impide el acceso a la carpeta del sistema
# "system" se debe cambiar si el nombre la carpeta se modifica.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# Esto impide el acceso a la carpeta de la aplicación
# 'application' se debe cambiar si el nombre la carpeta se modifica.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)/$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$ /$1 [R=301,L]
# Comprueba si el usuario está intentando acceder a un archivo válido,
# como un documento de imagen o CSS, si esto no es cierto
# se redirecciona a index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index.php|css|js|images|robots.txt)
RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
我認爲錯誤可以是:
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
但我的網站運行完美,我不知道是否刪除此行。
我必須做什麼?
謝謝!