• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue /opt/plesk/php/8.0/bin/php /var/www/vhosts/mymainsite.com/sub.mymainsite.com/artisan schedule:run >> /dev/null 2>&1

XTech

Basic Pleskian
Server operating system version
Ubuntu 22.04.1 LTS
Plesk version and microupdate number
Plesk Obsidian Version 18.0.50
Hello All,
I need help to run the Cron jobs for every minute or so on my new script. the app says (Please set the following cron command on your server (Ignore if already done)
* * * * * (Every Minute))


This is what the script/app suggests to run the Cron jobs in the server. /opt/plesk/php/8.0/bin/php /var/www/vhosts/mysite.com/sub.mysite.com/artisan schedule:run >> /dev/null 2>&1

"Note: /opt/plesk/php/8.0/bin/php in the above command is the path of PHP on your server. To ensure it works correctly, please enter the correct PHP path for your server and provide the path to your script. If you're unsure how to set up a cron job, you may want to consult with your server administrator or hosting provider."

when I added the above command and run it, it gave me this error and the app says it is not running.
Task "/opt/plesk/php/8.0/bin/php /var/www/vhosts/mysite.com/sub.mysite.com/artisan schedule:run >> /dev/null 2>&1" completed with error in 0 seconds.

attached is the screenshot of the setup I have and not sure if this * * * * * means to run every minute.
Thank you and appreciate any help.
 

Attachments

  • Capture.PNG
    Capture.PNG
    58.2 KB · Views: 40
Hmm... I am not sure what app you're trying to trigger for the cron but what you could do, if it's a PHP script (which, if it's trying to pull from PHP version 8, it's more likely is), is to choose "Run a PHP script" instead, enter in the /var/www/vhosts/mysite.com/sub.mysite.com/artisan path, choose the PHP version, and try then.
 
@XTech seems like you're using a Laravel based application. You can use the Plesk Laravel Toolkit to manage that app, which includes the option enable a Cron jobs (Scheduled Task) that runs the artisan schedule:run command.
Schermafbeelding 2023-02-02 125824.png

Otherwise you can add a the command to a Scheduled Task like /opt/plesk/php/8.0/bin/php '/var/www/vhosts/example.com/sub.example.com/artisan' 'schedule:run'. No need to add >> /dev/null 2>&1 to the command.
 
Thank you Kaspar, I tried but still same error I have 2 versions of my Laravel app/script and the one I am trying to run the Cron job is PHP 7, and when I tried to run and I get this error.

Task "/opt/plesk/php/7.4/bin/php /var/www/vhosts/mysite.com/app.mysite.com/artisan schedule:run >> /dev/null 2>&1" completed with error in 0 seconds.
 
You can use like below screenshot. I have done it.

command = /opt/plesk/php/8.1/bin/php '/var/www/vhosts/domain/subdomain/artisan' schedule:run >> /dev/null 2>&1

Cron style = * * * * *
 

Attachments

  • Screenshot_10.png
    Screenshot_10.png
    53.3 KB · Views: 48
The solution where /opt/plesk/php/<version>/bin/php is used requires full SSH access. This will work only if created as a cronjob by admin or in a subscription where the shell is set to a non-chrooted shell. It will not work where the shell is set to the chrooted shell, because then the /opt path cannot be accessed from by subscription user. In that case, please follow @scsa20 's advice in his post above Issue - /opt/plesk/php/8.0/bin/php /var/www/vhosts/mymainsite.com/sub.mymainsite.com/artisan schedule:run >> /dev/null 2>&1 to run this not as a shell command, but only the PHP script part as a PHP script. The type of execution can be set on the crontab configuration page.
 
Hello

Have same issue, i stuck at this stage: as per screenshot... Cron output:
Task "abc.def.com/artisan" successfully completed in 1 seconds, output:
2024-06-12 18:20:58 Running ['artisan' firewall:unblockip] ....... 96ms FAIL
⇂ '/opt/plesk/php/8.0/bin/php' 'artisan' firewall:unblockip > '/dev/null' 2>&1

Not sure if it is ok...

if i run using PHP 8.0, it shows:

Task "abc.def.com/artisan" completed with error in 0 seconds, output:
Error: Ask your hosting provider to use PHP 8.1.0 or higher for HTTP, CLI, and php command.

Current PHP version: 8.0.30

?
 

Attachments

  • Screenshot 2024-06-12 at 21.32.07.png
    Screenshot 2024-06-12 at 21.32.07.png
    296.5 KB · Views: 11
@Mike R I saw you posted on Facebook that switching to PHP version 8.1 did solve the issue. Is that correct?
Hello, i am not sure... I have the following output:
Task "abc.def.com/artisan" successfully completed in 1 seconds, output:
2024-06-13 11:57:26 Running ['artisan' firewall:unblockip] ....... 77ms FAIL
⇂ '/opt/plesk/php/8.0/bin/php' 'artisan' firewall:unblockip > '/dev/null' 2>&1
 
Task "abc.def.com/artisan" successfully completed in 1 seconds, output:
2024-06-13 11:57:26 Running ['artisan' firewall:unblockip] ....... 77ms FAIL
⇂ '/opt/plesk/php/8.0/bin/php' 'artisan' firewall:unblockip > '/dev/null' 2>&1
This means that the scheduled task (cron job) ran successfully, but that the firewall:unblockip command is failing for some reason. I am not sure how to solve that. I'd start by looking in the domain error logs to see if there more information there on the firewall:unblockip command.
 
This means that the scheduled task (cron job) ran successfully, but that the firewall:unblockip command is failing for some reason. I am not sure how to solve that. I'd start by looking in the domain error logs to see if there more information there on the firewall:unblockip command.
thanks, see nothing there, no warings, no errors
 
thanks, see nothing there, no warings, no errors
Web application firewall log:

AH01630: client denied by server configuration: /var/www/vhosts/balticnova.com/accounting.balticnova.com/artisan

[client 163.5.210.79] ModSecurity: Access denied with code 403 (phase 1). Matched phrase "/.git/" at REQUEST_URI. [file "/etc/httpd/conf/modsecurity.d/rules/comodo_free/02_Global_Generic.conf"] [line "117"] [id "210492"] [rev "3"] [severity "CRITICAL"] [tag "CWAF"] [tag "Generic"] [hostname "accounting.balticnova.com"] [uri "/.git/config"] [unique_id "ZmrkNCQUIF1BVbNVzbXTDAAAAMg"]
 
Web application firewall log:

AH01630: client denied by server configuration: /var/www/vhosts/balticnova.com/accounting.balticnova.com/artisan

[client 163.5.210.79] ModSecurity: Access denied with code 403 (phase 1). Matched phrase "/.git/" at REQUEST_URI. [file "/etc/httpd/conf/modsecurity.d/rules/comodo_free/02_Global_Generic.conf"] [line "117"] [id "210492"] [rev "3"] [severity "CRITICAL"] [tag "CWAF"] [tag "Generic"] [hostname "accounting.balticnova.com"] [uri "/.git/config"] [unique_id "ZmrkNCQUIF1BVbNVzbXTDAAAAMg"]
This error is unrelated to the issue your having. It the Web Application Firewall do it's job by blocking request to the .git directory.

Hello, i am not sure... I have the following output:
Task "abc.def.com/artisan" successfully completed in 1 seconds, output:
2024-06-13 11:57:26 Running ['artisan' firewall:unblockip] ....... 77ms FAIL
⇂ '/opt/plesk/php/8.0/bin/php' 'artisan' firewall:unblockip > '/dev/null' 2>&1
On my test server I noticed that somehow PHP version 8.0 still gets used to run the scheduled tasks. I am not sure why that is. If you don't need PHP 8.0 for any other domains you can consider uninstalling this version.
 
This error is unrelated to the issue your having. It the Web Application Firewall do it's job by blocking request to the .git directory.


On my test server I noticed that somehow PHP version 8.0 still gets used to run the scheduled tasks. I am not sure why that is. If you don't need PHP 8.0 for any other domains you can consider uninstalling this version.
thank you, now we have...:)

Task "accounting.balticnova.com/artisan" successfully completed in 4 seconds, output:
2024-06-17 14:12:20 Running ['artisan' firewall:unblockip] ...... 983ms DONE
⇂ '/opt/plesk/php/8.1/bin/php' 'artisan' firewall:unblockip > '/dev/null' 2>&1
 
Perfect, that shows that the Firewall command is now executed successfully (it no longer fails).

Are you familiair with the Laravel artisan command line commands? Akaunting uses the Laravel framework, which includes specific command-line commands that can be used to execute certain actions. For example you can run /opt/plesk/php/8.1/bin/php artisan'schedule:list to get all list of all scheduled tasks in the queue of the application.
 
it is still with FAIL:

2024-06-17 14:50:13 Running ['artisan' firewall:unblockip] ....... 98ms FAIL
⇂ '/opt/plesk/php/8.1/bin/php' 'artisan' firewall:unblockip > '/dev/null' 2>&1
 
Perfect, that shows that the Firewall command is now executed successfully (it no longer fails).

Are you familiair with the Laravel artisan command line commands? Akaunting uses the Laravel framework, which includes specific command-line commands that can be used to execute certain actions. For example you can run /opt/plesk/php/8.1/bin/php artisan'schedule:list to get all list of all scheduled tasks in the queue of the application.
No, not familiar at all... Understood i can trigger some commands using same scheduled task page, like reccuring:check, reminder:invoice... and it is actually works and do it's tasks
 
Back
Top