Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.
This repository was archived by the owner on May 22, 2024. It is now read-only.

Undefined index: REQUEST_METHOD #44

@GilDev

Description

@GilDev

Hi,
I discovered Atomik few days ago and I LOVE it! Now, I'm making a website for my classmates, just a little web game, and I need to execute a PHP script every midnight. I used ConsoleKit and I'm using Nginx on a Raspberry Pi (Debian). So when I type my command php index.php <command>, it works well, but when I add this line in my cron table: 0 0 * * * php /path/to/index.php <command>, it doesn't works and outputs this error:

PHP Notice: Undefined index: REQUEST_METHOD in /var/www/vendor/atomik/atomik/src/Atomik.php on line 363
PHP Fatal error: Uncaught exception 'AtomikException' with message 'HTTP method not allowed' in /var/www/vendor/atomik/atomik/src/Atomik.php:369
Stack trace:

0 /var/www/vendor/atomik/atomik/src/Atomik.php(209): Atomik::dispatch(NULL)

1 /var/www/index.php(3): Atomik::run()

2 {main}

thrown in /var/www/vendor/atomik/atomik/src/Atomik.php on line 369

So it's saying REQUEST_METHOD isn't defined. That's normal because I'm using php-cli (although I don't understand why it works in shell but not with cron), now is there a solution to make my script not crash? Maybe Atomik could use some sort of error checking with php_sapi_name()?
I hope you'll have a solution, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions