Error With The out put of cronjob

SYSTEM INFORMATION
OS type and version AlmaLinux 8.10
Webmin version 2.202
Virtualmin version 7.20.2
Webserver version Apache php 8.2
Related packages SUGGESTED

when i run my cron i get this error in the output

PHP Warning:  include_once(./assets/libraries/SimpleImage-master/vendor/claviska/simpleimage/src/claviska/SimpleImage-Class.php): failed to open stream: No such file or directory in /home/screenshotly/public_html/assets/includes/functions_one.php on line 7442.
PHP Warning:  include_once(): Failed opening './assets/libraries/SimpleImage-master/vendor/claviska/simpleimage/src/claviska/SimpleImage-Class.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/screenshotly/public_html/assets/includes/functions_one.php on line 7442.

this is the code which mentioned in the error:

include_once('./assets/libraries/SimpleImage-master/vendor/claviska/simpleimage/src/claviska/SimpleImage-Class.php');

and this is the path to the file contain this code:

/home/screenshotly/public_html/assets/includes

and this is the assets folder:

i tried to solve it by adding

../libraries/SimpleImage-master/vendor/claviska/simpleimage/src/claviska/SimpleImage-Class.php

but it didnt work also

can anyone help ?

Nothing to do with virtualmin but to do with your installed app 
 it can not find the resource you need, perhaps you need to ```cd`` to the app directory before you run it so any relative paths are correct. That said some apps will add the full path to resources rather than relative. Don’t forget running programs via a cron the user environment can be different and you may need to add some environment variables to your cron setup

1 Like

can you add a screenshot of your cronjob, I need to just see if it is correct.

and also where and how did you add the cronjob just to check that aswell.

When you run php scripts you need to make sure the paths are correct, also the version of PHP being run aswell.

1 Like

yes sir i use wowonder script and the cron is ready from the wowonder company and i installed it as they described in the documents but when i run it i found no output message so someone advised me to add vvv in the last of the command to know what is the problem, then i found this error

this is the cron

Never come across this option . What does it do ?
Edit you have a > stuck on the end of the command that needs a space

'cron-job.php> -vvv seems wrong

‘>’ is used to output to a file and then ‘-vvv’ I dont recognise this php switch.

I am not an expert.

this seems a path issue. Either the code is faulty or you need to add the folder the PHP should run from, I forget what it is called.

Navigate the root folder of the public_html and run the command manually. forget about cron for now, you need to see to get the command running first be setting it on a schedule.

Setup a local xampp and xdebug setup and then do a stack.code trace, you will soon see what is going on (p.s. I cant help with this but you tube can).

  • Is this file design to be run by the CLI or by cURL?
  • Is this file actually designed to be run by cron?
  • I think you need to see help of the developers for this one.

The information that you have given is very limited but I think he developers of this library are better to ask.

It’s normally convention to name a php script with the word cron in it as a cli script, however there are a few out there that will run in any fashion you want the coder has tested the SAPI and run code according to that result.
Php excutable is normally /bin/php
Just use which php to find out on your system

1 Like

this is the real cron docs from developers:

and in my case the cron command should be:
*/5 * * * * php -f home/screenshotly/public_html/cron-job.php > /dev/null 2>&1

and iam sure that is my real pass which contain the cron php file

when i run this command i get not output found

this is the real cron docs from developers:

and in my case the cron command should be:
*/5 * * * * php -f home/screenshotly/public_html/cron-job.php > /dev/null 2>&1

and iam sure that is my real pass which contain the cron php file

when i run this command i get not output found.

this sends output to nothing.

You need to go and study this software and how php works.

what should i do then ? all i need is help to setup this command as the developer told me
i installed it correctly as u see so i want to check if it work or no can u help with that ?

Stop piping the output to null then you can read the errors/output, if any, but as this is not an error with virtualmin you need to get help from the people who coded the script in the first place they should be able to advise once they see the error you are getting

1 Like

So you do have that file?

home/screenshotly/public_html/assets/libraries/SimpleImage-master/vendor/claviska/simpleimage/src/claviska/SimpleImage-Class.php

as thats the error

failed to open stream: No such file or directory

How would we know ? the output is being piped to null

as its in the first post :slight_smile:

1 Like

yes sir i have this file in the same location but it give me error in the output of the cron

try using the full path like I posted

Assuming that is the error that the cron shows, my guess is that the OP is not changing to the directory (mentioned earlier) so the cron job may have to be
cd /home/user/public_html && php cronjob.php I reread the post and the ‘missing’ file path begins with a dot which will look for the file in the directory below where the script was envoked cron jobs have no environment so therefore will have no path set and most probably runs from / so the is no file as include_once('./assets/libraries/SimpleImage-master/vendor/claviska/simpleimage/src/claviska/SimpleImage-Class.php') as it will be looking in the / directory and not the users public_html directory which is where the file resides. I will code something up tomorrow to prove POC

Hey,

  1. First it’s a Warning. So everything else should works.

  2. Then it’s not about the cronjob itself. But what is inside functions_one.php

  3. Considering it’s not related to Virtualmin here stackoverflow workarounds:

  1. The only way we could help would be to have the content of “functions_one.php” and “cron-job.php”

Some part to check

  1. Does “functions_one.php” have the right permission to access " SimpleImage-Class.php" ?

  2. Just checking again what you said:

What the “./assets/” Is doind here ? Shouldn’'t it be this:

include_once("../libraries/SimpleImage-master/vendor/claviska/simpleimage/src/claviska/SimpleImage-Class.php");

Yes it’s What you did ! The first can clearly NOT work considering “./assets/” Means “assets/” (So a folder inside the current folder) and there are no “assets” folder in the current “includes” folder

Still “Libraries” and “Includes” are both in the same folder but you said yourself it doesn’t work too when you replaced the first by the second.

But “SimpleImage-Class.php” seems in a very deep folder so I come back to my suggestion 2) are you sure there are the right permission to access it. What if you copy paste “SimpleImage-Class.php” in the “Includes” folder and then replace the include_once with:

include_once("SimpleImage-Class.php");

Then we do not have enough clues about what is inside functions_one.php and the
“on line 7442” indicate everything before works (And after too). So it may simply be a typo somewhere. We might need to see the source (what is before the “include_once” ?)