使用PHP和Apache创建一个cron作业

I have Apache running on Debian with PHP 5.4.
PHP-cli is installed.
My directory structure for the web project is:

 - /myproject
     - /src
         - /controller
             - getProviders.php
         - /model
         - /public
         - ClassLoader.php

I want to create a cron job to execute getProviders.php every 5 minutes. This is as far as I have come:
*/5 * * * * /usr/bin/php /var/www/myproject/src/controller/getProviders.php

It doesn't work because I have a require_once in getProviders.php requiring ClassLoader.php, but he can't find it.
require_once "../ClassLoader.php"

getProviders.php works when executed via URL.

I'm not new to PHP development, but new at configuring the server around it. What do I have to do to make it work. I'm guessing I have to set the include path, but I have no idea to what exactly.

Thanks in advance for your help.

To make sure the require_once will always work, you could use dirname(__FILE__) + the path relative to the getProviders.php

In your case this would be:

require_once(dirname(__FILE__)."/../ClassLoader.php");

Change to the right workdirectory.

You could do this with the cd command or inside your PHP script with the chdir() function.

Create a shell script like this in /usr/sbin (For Example: getProviders)

#!/bin/bash -x
cd  /var/www/myproject/src/controller/
php getProviders.php

give permission

chmod a+x /usr/sbin/getProviders

in /etc/crontab

*/5 * * * * root /usr/sbin/getProviders

the problem is probably due to inclusions not in absolute value in the php script