0

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
1
  • 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 Commented Jul 13, 2015 at 12:46

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

5 Comments

excuse me Giorgio but what i am i supposed to set on define and on include?
That's what i put but it still does not work<?php define('ROOT', 'C:/wamp/www/GDP_2006'); include ROOT . 'php/include/head.php'; include ROOT . 'php/Classes'; Greeter::autoThread(); ?>
Try to echo the resulting path. It seems like it will be something like C:/wamp/www/GPD_2006php/include/head.php. I suspect you're missing a slash between GPD_2006 and php. Also, see my edit.
Giogio hi, my head.php calls another php file a already included them but it stops in file which contains a class that is extended from DatabaseAccesser and it stops :( what can i do to solve this?
Ehrm... Start with debugging. Then ask a clear question. Because with this info, I can only be as clear as you are yourself; most probably something is wrong ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.