• 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!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Scheduled task problem

Peter-

Basic Pleskian
Hi

Me again :)

I'm having problems with scheduled tasks, as follows:

If I run script A from browser, it works with no problem (PHP script).

If I run from console from the same folder, it works. If I do it from a different folder, I'm getting include errors.

Therefore, my command /usr/bin/php /var/www/vhosts/domain.com/subdomain.domain.com/cron/script.php > /dev/null 2>&1 fails.

I tried a "cd" command from console before the php one and it works, but not from plesk scheduled tasks.

Anything I can do to solve this? To be honest I am a bit upset I always have to configure something because it's not there or doesn't work.

Thanks,
- Peter
 
Common problems to that is if you are not using FULL paths in your include, require, include_once statements!

For example, if you have an
Code:
include_once("cron/somescript.php");
then it should be instead
Code:
include_once("/var/www/vhosts/domain.com/subdomain.domain.com/cron/somescript.php");

Confirm you are using full paths?
 
Nope. This isn't going to work for me, especially when copying full folders from a subscription to another.
 
In that case you can use:

Code:
$dir = dirname(__FILE__)

This should dynamically give you the directly absolute path to current file. The use the $dir to define the respective paths ..

Code:
include_once($dir."/somescript.php");
 
Ok so what setting do I actually have to change in order to avoid this in the future? ie. instead of changing all my scripts :)

I also don't understand why I cannot send 2 commands in one line in plesk. If I use cd /my/script/path ; /usr/bin/php /my/script it doesn't run.

Also my session cookie expires at random times, instead of 30 minutes how it's supposed to.
 
Last edited:
Ok so... I finally managed to find a solution... I had to enable ssh access for that user to have access to /usr/bin/php . I also had to restart crond because I wasn't receiving anymore notifications. Now it's working fine.

For others, to avoid having to edit php files to use absolute paths, you can cd the crond before running the php command, like:

* * * * * cd /var/www/vhosts/domain.com/httpdocs ; /usr/bin/php /var/www/vhosts/domain.com/httpdocs/whatever.php

Took me only one day to fix it :)
 
Common problems to that is if you are not using FULL paths in your include, require, include_once statements!

Are you serious?!

Haven't you heard about include_path or -d? Include path should either be set via command line ( php -d include_path="PATH1:pATH2" script.php ) or via php.ini which can be set via -c.
 
That's what I was hoping to get in the first place. Unfortunately, I don't know what to put in the include path. I have tried something in php ini but it didn't improve anything on my box :)

Any idea for my other problem? At random times, especially if browsing phpmyadmin, I have to relogin and navigate back. Sometimes it's 2 minutes after I logged in, sometimes it's 10, it's never 30 like my session idle time setting says.

I'm using latest chrome with default settings (js and cookies enabled). Working perfect on any other site, except my plesk panel :) I also checked my IP, it doesn't change. Well, it changes on a daily basis, but not every 2 to 10 minutes.

Thanks again!
 
Last edited:
Any idea for my other problem? At random times, especially if browsing phpmyadmin, I have to relogin and navigate back. Sometimes it's 2 minutes after I logged in, sometimes it's 10, it's never 30 like my session idle time setting says.

Honestly, no idea. Maybe time flow or difference issues on server and/or client. Maybe random switching between ipv4/ipv6 in client requests. Maybe indeed dynamic IPs (even if you're sure it's not the case).
 
Hmm... Maybe a bug in plesk 11.5. I don't remember having this problem before the upgrade, which also forced me to delete and re-add all subscriptions due to a server fault.
 
I have to relogin and navigate back. Sometimes it's 2 minutes after I logged in, sometimes it's 10, it's never 30 like my session idle time setting says. I'm using latest chrome with default settings (js and cookies enabled). Working perfect on any other site, except my plesk panel :) I also checked my IP, it doesn't change. Well, it changes on a daily basis, but not every 2 to 10 minutes.

In situations I have experienced this behavior, most of them the reasons have been:

1. Dynamic IPs - 90% of all the times
2. Old cookies, clear ALL cookies from your browser (restart the browser) and try again!
3. Possibility of plesk or plesk nginx,php-fpm crashing (rarely though) but however monitor the plesk log file for any clues [/usr/local/psa/admin/logs/panel.log]
 
Hi again

1. I had the same IP the whole day
2. Not the case. I clear my cookies every day and this is happening very often. It's clearly not a browser problem.
3. Highly probable. On the same server, I have a mantis bug tracker installed. Never had a problem with it.
 
I'm back with more info about the cookie thing :)

Apparently, this happens only in chrome and I was able to reproduce it like this: you open multiple tabs, navigate to a domain, open phpmyadmin, browse some table, switch tab to something different than plesk (say facebook.com). Repeat this multiple times on different sites and when you get back to phpmyadmin and click on browse table again, you're out.

No clue why this is happening :)

--
 
Back
Top