Reputation: 11
I'm stuck on a this special problem:
I have a php application which manage a request process; when the request is sent an email is also sent to the several validators. What i want is when one of the validators does not validate the request, a reminder email should be sent to him 3 times every 30 minutes.
For that i create the function bellow which is related to other classes but it does not work. This function will be executed as a planned task but before i tried to execute it as a line command : 'php -f C:\wamp\www\test_2006\job.php' .
This job.php contains that:
My function is
public static function autoThread()
{
parent::connection()->open();
foreach( Greeter::getAllRequests() As $request )
{
if( in_array( $stage=$request->stage(),array( "threader","requester","CLOSED" ) ) ) continue;
$currentIdUser = $request->requester()->chef( $stage );
$r = parent::connection()->executeQuery( " SELECT id FROM notification WHERE matriculeUser = '$currentIdUser' AND requestId = {$request->id()} " );
if( $r->rowCount()>2 )
{
( new User( $currentIdUser ) )->judgeRequest( array( $request->id()=>"BYPASS" ) );
}
else
{
parent::connection()->executeQuery( " INSERT INTO notification ( matriculeUser,requestId ) VALUES ( '$currentIdUser',$request->id() )" );
Greeter::validationMail( $request );
}
}
}
The error that i get is :
Warning: include(php/Classes/FrameworkDb.php): failed to open stream: No such file or directory in C:\wamp\www\test_2006\php\include\head.php on line 3
Call Stack:
0.0000 229496 1. {main}() C:\wamp\www\test_2006\job.php:0
0.0000 236808 2. include('C:\wamp\www\test_2006\php\include\head.php')
C:\wamp\www\test_2006\job.php:3
Warning: include(): Failed opening 'php/Classes/FrameworkDb.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\test_2006\php\include\head.php on li
ne 3
Call Stack:
0.0000 229496 1. {main}() C:\wamp\www\test_2006\job.php:0
0.0000 236808 2. include('C:\wamp\www\test_2006\php\include\head.php')
C:\wamp\www\test_2006\job.php:3
Fatal error: Class 'User' not found in C:\wamp\www\test_2006\php\include\head.php
on line 12
Call Stack:
0.0000 229496 1. {main}() C:\wamp\www\test_2006\job.php:0
0.0000 236808 2. include('C:\wamp\www\test_2006\php\include\head.php')
C:\wamp\www\test_2006\job.php:3
Upvotes: 0
Views: 77
Reputation: 10202
First of all; please add any errors in the question itself in a code block (you can edit your question). Errors in comments are really hard to read...
Furthermore; the error says no such file or directory
, meaning you are including the file from a non-existent place. Please checkout paths etc. When you are using CLI, relative paths are most of the time different then from normal execution (from the browser). You can tackle this by defining a root path:
define('ROOT', '/home/users/ssa/');
include ROOT . 'some_dir/my_file.php';
As the ROOT
constant you fill in the path of your document root (the directory where you can find your index.php). Then every time you include a file, you prepend the constant to the relative path from the doc root.
Upvotes: 2