Cron Job Error when running a PHP file

Asked
Active3 hr before
Viewed126 times

9 Answers

error
90%

that's saying "get input from a file called ?php", which of course doesn't exist, so you get ?php: No such file or directory. You need to add a "hashbang" to the start of your file to tell it to run the script using the PHP interpreter:,I'm new to use cron jobs, i've set correctly the crontab, the PHP file is running but I receive this error:, Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,The file PHPMailerAutoload.php on the server is in /data/applicazioni/shuttle/server/phpmailer/PHPMailer-master/

Cron scripts are expected to be shell scripts, and < is a redirect operator in a shell, so when you say:

< ? php
load more v
88%

The .php file is ioncube encoded, so I cannot go in there and edit it or something, however ioncube loaders are working properly and I can log in to the script which is encoded as well. I have received notice from the seller that the license is good, so I don’t see why the cron job throws these errors. * I’ve also done this before on a differnt server and then it worked. ,I am running into these errors when trying to execute a cron job (both from the command line or from a cron tab) : ,It looks like the php script was written to be run by a webserver, not from a cron job. The script is failing because environment variables that the webserver would set for it have not been set when running as a standalone script., question phpMyAdmin mycrypt issue I just got started with DigitalOcean yesterday, my first VPN so apologies in advance for any unnecessary questions. I have been able to install dependencies for NodeBB and also install NodeBB itself. But now I'm also trying to setup for WordPress...

I am running into these errors when trying to execute a cron job (both from the command line or from a cron tab) :

PHP Notice: Undefined index: SERVER_NAME in /var/www / forwardial.com / htdocs / lib / app.inc on line 0
PHP Notice: Undefined index: REQUEST_URI in /var/www / forwardial.com / htdocs / lib / app.inc on line 0
PHP Warning: WURFL_ClassLoader::loadClass(/var/www / forwardial.com / htdocs / WURFL / Configuration / InMemoryConfig.php): failed to open stream: No such file or directory in /var/www / forwardial.com / htdocs / WURFL / ClassLoader.php on line 0
PHP Warning: WURFL_ClassLoader::loadClass(/var/www / forwardial.com / htdocs / WURFL / Configuration / InMemoryConfig.php): failed to open stream: No such file or directory in /var/www / forwardial.com / htdocs / WURFL / ClassLoader.php on line 0
PHP Warning: WURFL_ClassLoader::loadClass(): Failed opening '/var/www/forwardial.com/htdocs/WURFL/Configuration/InMemoryConfig.php'
for inclusion(include_path = '.:/usr/share/php') in /var/www / forwardial.com / htdocs / WURFL / ClassLoader.php on line 0
PHP Fatal error: Class 'WURFL_Configuration_InMemoryConfig'
not found in /var/www / forwardial.com / htdocs / WURFLres / wurfl_config_standard.php on line 0

code
72%

If there was no error output that needed to be mailed to you, then the script ran successfully as far as cron could tell. Your question does not specify what leads to you believe that something is wrong. – user535733 Feb 11 at 20:08 , Questions ,I also needed a cron job in order to run a php file with a null output:,The hosting service does not allow "special" characters (>) in the input text for the command, so it had to be executed inside an executable .sh file (with -rwxr-xr-x permissions or 755).

I also needed a cron job in order to run a php file with a null output:

* * * * * /usr/bin / php / path / to / script / cron.php > /dev/null
load more v
65%

In this command, curl retrieves the web page, which then runs the PHP script.,In this example, the PHP command-line interpreter runs the script.php file in the user's public_html directory. The -q option enables quiet mode, which prevents HTTP headers from being displayed.,A common method for running PHP scripts from a cron job is to use a command-line program such as curl or wget. For example, the cron job runs a command similar to the following command:,Using the internationalization extension in PHP

A common method for running PHP scripts from a cron job is to use a command-line program such as curl or wget. For example, the cron job runs a command similar to the following command:

curl http: //example.com/script.php

However, there is a better way to run PHP scripts on your web site from cron jobs. You can run the script directly by using the PHP command-line interpreter. This method is just as effective, and usually faster. The following command shows how to run a script using the PHP command-line interpreter:

php - q $ {
   HOME
}
/public_html/script.php

Depending on the code in your PHP script, it may only run correctly when called from a specific directory. For example, if the script uses relative paths to include files, it will only run if it is called from the correct directory. The following command shows how to call a PHP script from a specific directory:

cd $ {
   HOME
}
/public_html/;
php - q script.php

If your script requires special configuration options, you can use a custom php.ini file. The -c option allows you to call a PHP script using a custom php.ini file:

php - c $ {
   HOME
}
/php.ini ${HOME}/public_html / script.php
load more v
75%

The Moodle 'cron' process is a PHP script (part of the standard Moodle installation) that must be run regularly in the background. The Moodle cron script runs different tasks at differently scheduled intervals. ,Moodle has two different ways to deploy cron which use different scripts within the Moodle install. These are as follows... ,1 General discussion 1.1 Working out the Moodle cron command 1.2 The web based Moodle cron command 1.3 Finding the right place to put the command ,1.2 The web based Moodle cron command

/path/to / moodle / admin / cli / cron.php
/usr/bin / php / path / to / moodle / admin / cli / cron.php
load more v
40%

I've compared get_include_path() and it returns the same location whether I'm running from cronjob or the script directly.,I've checked crontab to ensure that the conjob is being run by the same owner/group as the script and include file, but again, no errors being reported.,I've tried using include() instead of require() in order to trigger a warning, but this produces the same problem.,I've used file_exists() to ensure that the include file I'm trying to require exists at the $abspath I'm providing to the function.

/opt/cpanel / ea - php73 / root / usr / bin / php - f / home / full / path / to / your / cron.file.php
22%

I'm developing an app that should runs once a day a PHP script for sending mail and SMS.,I'm new to use cron jobs, i've set correctly the crontab, the PHP file is running but I receive this error:,Cron scripts are expected to be shell scripts, and < is a redirect operator in a shell, so when you say:,that's saying "get input from a file called ?php", which of course doesn't exist, so you get ?php: No such file or directory. You need to add a "hashbang" to the start of your file to tell it to run the script using the PHP interpreter:

I'm new to use cron jobs, i've set correctly the crontab, the PHP file is running but I receive this error:

/srv/applicazioni / shuttle / server / mylac.php: line 1: ? php : No such file or directory /
   srv / applicazioni / shuttle / server / mylac.php: line 2: syntax error near unexpected token `'/data/applicazioni/shuttle/server/phpmailer/PHPMailer-master/''
/srv/applicazioni/shuttle/server/mylac.php: line 2: `
set_include_path('/data/app'
      icazioni / shuttle / server / phpmailer / PHPMailer - master / ');

This is the point in the script that I receive the error:

< ? php
set_include_path('/data/applicazioni/shuttle/server/phpmailer/PHPMailer-master/');
require 'PHPMailerAutoload.php'; ?
>
load more v
60%

You can no longer run dev/tools/cron.sh because the script has been removed.,Get started with command-line configuration,The Magento crontab is the configuration used to run Magento cron jobs.,Magento uses cron tasks that can run with different configurations. The PHP command-line configuration controls the general cron job that reindexes indexers, generates e-mails, generates the sitemap, and so on.

1
bin / magento cron: install[--force]
1
bin / magento cron: install[--force]
load more v
48%

I am only issuing echo statements in my PHP when there is a query error. But I don't have errors, and I see the lines appearing in my DB.,Yet, I still get emails with (nearly) empty content even if I don't have errors:,Making statements based on opinion; back them up with references or personal experience.,Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.

My provider says:

An email will be sent to this address ONLY
if your cron produces output.
If no output is generated, then no email will be sent.
load more v

Other "error-undefined" queries related to "Cron Job Error when running a PHP file"