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

Undefined index: REQUEST_METHOD #44

Open
GilDev opened this issue May 9, 2015 · 0 comments
Open

Undefined index: REQUEST_METHOD #44

GilDev opened this issue May 9, 2015 · 0 comments

Comments

@GilDev
Copy link

GilDev commented May 9, 2015

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant