简体   繁体   中英

Heroku require_once error

I am developing a php application locally, and all works well until I push to heroku, where the log gives me this error:

PHP Warning:  require_once(/app/src/web/../../etc/s_init.php): failed to open stream: No such file or directory in /app/src/web/index.php on line 2

This is the troublesome piece of code:

require_once(__DIR__ . '/../../etc/s_init.php');

It works locally but doesn't work when pushed to heroku. The directory looks like this:

- etc
   - s_init.php
- src
   - web
      - index.php

I have run out of ideas at this point. Why is this error occurring, and how can it be fixed?

Thanks!

The error tells you the problem:

(/app/src/web/../../etc/s_init.php)

That's not a valid path. Try this:

require_once('../../etc/s_init.php');

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