简体   繁体   中英

Calling a PHP (Fat Free Framework) file from a bash script in Linux is giving me "No Routes Specified" error

I am working on a PHP (Fat free framework) project in Linux. The project is running fine when I call it directly from the cli.

    > cd /var/www/html/test/proj/source/
    > php index.php controller_name/action_name/parameter1

However, I cannot run the project from a bash script. I have created a bash script with following content:

/usr/bin/php /var/www/html/test/proj/source/index.php controller_name/action_name/parameter1

I get the following error

"No routes specified" [/var/www/html/test/proj/source/index.php:LINE_NUMBER] Base->run()

I couldn't find anything about it on https://www.fatfreeframework.com

Probably it does not work because the app's root path is a different. Change the working dir with cd /var/www/html/test/proj/source/ first before calling index.php, because otherwise relative paths within the app are screwed and things like $f3->config('config.ini') , where you might have defined the routes, isn't finding the file to load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM