我有一臺運行centOS的主機。我的網站是基於Magento,它是現場直播。測試在windows/wamp上運行cron作業的magento模塊
我創建了一個每分鐘運行一次cron作業的模塊。
我的問題是:我在windows上運行我的本地主機(wampserver 2.0)。在我的模塊上載實時主機之前,我想在本地主機上測試它。是否有可能在Windows上測試我的cron作業運行模塊?
我有一臺運行centOS的主機。我的網站是基於Magento,它是現場直播。測試在windows/wamp上運行cron作業的magento模塊
我創建了一個每分鐘運行一次cron作業的模塊。
我的問題是:我在windows上運行我的本地主機(wampserver 2.0)。在我的模塊上載實時主機之前,我想在本地主機上測試它。是否有可能在Windows上測試我的cron作業運行模塊?
你至少有2種選擇:
通過說你的模塊「運行」一個cron作業,你可能意思是說增加了一個cron作業。爲了測試它,你不需要在你的windows本地主機上運行一個cron。您可以通過從Magento安裝的根目錄運行cron.php
來手動觸發所有Magneto cron作業。你可以從這樣的瀏覽器中這樣做http://localhost/magento_dir/cron.php
。
您可以使用schtasks.exe創建一個新的計劃任務,以根據需要運行。
schtasks /create /sc minute /mo 1 /tn "Cron" /tr "php -f C:\wamp\www\pro\run.php"
您可以找到有關命令的詳細信息,並在我的博客的鏈接下方的使用。
如果使用Windows 2008及更高版本進入管理MMC和配置下訪問任務調度。對於1.8法師必須在你的陳述中加上-mdefault 1。 cron文件中有更改。
Magento的2.0.2 打開命令提示符
寫
cd c:\xampp\htdocs\magento202\bin
php magento cron:run
php magento cron:run
cd C:\xampp\htdocs\magento202\update
php cron.php
cd c:\xampp\htdocs\magento202\bin
php magento setup:cron:run
與你更換目錄 'magento202'
「你可以從這樣http://localhost/magento_dir/cron.php瀏覽器做」>你會得到Acces拒絕 - >去編輯.htaccess和註釋行
###########################################
## Deny access to cron.php
## <Files cron.php>
############################################
## uncomment next lines to enable cron access with base HTTP authorization
## http://httpd.apache.org/docs/2.2/howto/auth.html
##
## Warning: .htpasswd file should be placed somewhere not accessible from the web.
## This is so that folks cannot download the password file.
## For example, if your documents are served out of /usr/local/apache/htdocs
## you might want to put the password file(s) in /usr/local/apache/.
#AuthName "Cron auth"
#AuthUserFile ../.htpasswd
#AuthType basic
#Require valid-user
############################################
## Order allow,deny
## Deny from all
##</Files>