I have this error on my site after I moved it from a shared hosting to a VPS (both with cPanel).
PHP Warning: include(): Failed opening '../../../transporturi/a.php'
for inclusion
(include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in [...]
on line 36.
In the other file on line 36 I have included a PHP file, I checked the path and it's there. I also tried to switch PHP version from the WHM from 5.5 to 5.6 to 7.0, but no luck.
The path is relative to the file that received the request, so you can use the PHP DIR magic constant to know what is your current directory:
echo(__DIR__);
and then form the absolute path relative to your file as below.
include(__DIR__ . '../../../transporturi/a.php');
Now it depends on your directory structure and the location of both the included file and the one where its included.
Related
Can't install wordpress the error after entering domain. the hosting PHP version is 5
Warning: require(DIR/cherry-framework/setup.php) [function.require]: failed to open stream: No such file or directory in /home/content/a/s/c/asclaw/html/wp-content/plugins/power-builder/tm-builder-core.php on line 42
Fatal error: require() [function.require]: Failed opening required 'DIR/cherry-framework/setup.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/a/s/c/asclaw/html/wp-content/plugins/power-builder/tm-builder-core.php on line 42
download CherryFramework. Extract cherry-plugin.zip files to wp-content/plugins/cherry-plugin directory replacing existing files. This should fix the issue.
I had the same issue. I discovered the site was running on PHP 5.3 even though their cpanel showed the server was running 5.4.
I added the following to the .htaccess and it got the site working:
AddHandler application/x-httpd-php54 .php
Check you PHP version, I'm sure that's the issue.
I have a CakePHP install that won't resolve paths correctly using include_path.
Here's an example of an error from the PHP log.
PHP Warning: include(\website\cakephp\lib\Cake\Utility\Debugger.php): failed to open stream: No such file or directory in D:\website\cakephp\lib\Cake\Core\App.php on line 545
PHP Warning: include(): Failed opening '\website\cakephp\lib\Cake\Utility\Debugger.php' for inclusion (include_path='.;d:\website') in D:\website\cakephp\lib\Cake\Core\App.php on line 545
PHP Fatal error: Class 'Debugger' not found in D:\website\cakephp\lib\Cake\Error\ErrorHandler.php on line 223
My website is installed on drive D: but all calls to App::uses resolve to paths where the drive letter has been removed.
I've specified include_path = ".;D:\website" in the php.ini file.
Not sure what else can be done to resolve this issue.
EDIT:
If I change the input_path to .;D:\ then includes start working correctly.
I'm thinking there is something wrong with how my index.php configures paths.
I'm working on a restful API in php.
All is working on localhost, but when I try to put it on my server, I have these errors :
Warning: include_once(/path/to/api/simpletodo_api/Models/TodoItem.php) [function.include-once]: failed to open stream: No such file or directory in /homez.338/login/www/path/to/api/simpletodo_api/index.php on line 6
Warning: include_once() [function.include]: Failed opening '/path/to/api/simpletodo_api/Models/TodoItem.php' for inclusion (include_path='.:/usr/local/lib/php') in /homez.338/login/www/path/to/api/simpletodo_api/index.php on line 6
Here my include :
include_once 'Models/TodoItem.php';
index.php and the "Models" folder are in the same folder (in local and on my server).
I'm pretty sure it is a path error, but I can't find the right one.
Have you an idea of the path ?
If your server is Linux-based and your localhost is on Windows, you may be running into file naming errors. File paths in Linux are case-sensitive. Just to be sure prepend the __DIR__ constant to your PHP path like so: include_once __DIR__ . 'Models/TodoItem.php';
I've been using Laravel 3 on a live website for a while, and decided to move the app to outside of docroot, delete the public_html folder, and symlink the public folder to the public_html one. I followed solution 1 here.
Having done that, my site has stopped loading, giving a 500 error. When I checked the error log in public/error_log, this message appears:
[05-Feb-2013 08:07:25] PHP Warning: chdir() [<a href='function.chdir'>function.chdir</a>]: No such file or directory (errno 2) in /home4/indieweb/indiewebseries/paths.php on line 62
[05-Feb-2013 08:07:25] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required '/home4/indieweb/indiewebseries/public/laravel/laravel.php' (include_path='.:/usr/lib64/php:/usr/lib/php:/usr/share/pear') in /home4/indieweb/indiewebseries/public/index.php on line 34
Just for reference:
// paths.php on line 62:
chdir(__DIR__);
// index.php line 34:
require path('sys').'laravel.php';
Any ideas?
EDIT: I tried #TheShiftExchange suggestion, moved everything outside of docroot, and renamed public to public_html. I now get these php errors:
[07-Feb-2013 05:38:25] PHP Warning: chdir() [<a href='function.chdir'>function.chdir</a>]: No such file or directory (errno 2) in /home4/indieweb/paths.php on line 62
[07-Feb-2013 05:38:25] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required '/home4/indieweb/public_html/laravel/laravel.php' (include_path='.:/usr/lib64/php:/usr/lib/php:/usr/share/pear') in /home4/indieweb/public_html/index.php on line 34
I found the solution. It turns out all my problems were irrelevant. For some reason, the PHP settings in my hosting account were reset, and all I had to do was switch the PHP version back to 5.4 to fix everything.
I'm trying to follow along with a book on Amazon EC2 and it says to include a new file path in php.ini in the etc folder to the cloudfusion sdk. So I uncommented the path variable in php.ini.default and set the new path to be:
include_path = ".:/php/includes:/Users/john/cloudfusion"
but yet when I try running my php script inside a folder named amazon, it keeps giving me the error:
Warning: require_once(sdk.class.php): failed to open stream: No such file or directory in /Users/john/amazon/create_bucket.php on line 26
Fatal error: require_once(): Failed opening required 'sdk.class.php' (include_path='.:') in /Users/john/amazon/create_bucket.php on line 26
Anybody have any ideas?
PHP doesn't read php.ini.default, it just defaults to the values in it internally, to make sure your changes are read, you can copy that file to php.ini and edit your values.
Alternatively you can use http://nl3.php.net/ini_set function to modify your include path on-the-fly. You need to use ini_set before the actual require_once.