php require failed to open stream: - php

I'm having a problem regarding the access to ros ezpdf using composer
Now i want using the green file (requisicoesDiarias.php) showed in the image, i want to access the red one (dbconfig.php) to get the result from a query and then show this result in a pdf (blue folder)
What i have until now is this
include_once '../../../db/dbconfig.php';
require_once __DIR__ . '/../vendor/autoload.php';
set_include_path('../vendor/ros/ezpdf/src/' . PATH_SEPARATOR . get_include_path());
I have the following errors
Warning: include_once(/home/ebspma/public_html/gest/pages/multimedia/pdf../../../vendor/autoload.php): failed to open stream: No such file or directory in /home/ebspma/public_html/gest/pages/multimedia/pdf/requisicoesDiarias.php on line 7
Warning: include_once(/home/ebspma/public_html/gest/vendor/ros/ezpdf/src): failed to open stream: No such file or directory in /home/ebspma/public_html/gest/pages/multimedia/pdf/requisicoesDiarias.php on line 8
I have put a file in that folder ros->ezpdf->src to get current path and i have this
/home/xxxxx/public_html/gest/vendor/ros/ezpdf/src
any help?

Related

Failed to open stream: No such file or directory, when using __DIR__

PHP is throwing this error when trying to access autoload: require_once __DIR__ . '/../vendor/autoload.php';
Warning:
require_once(/Applications/MAMP/htdocs/crud_app/public/vendor/autoload.php):
Failed to open stream: No such file or directory in
/Applications/MAMP/htdocs/crud_app/public/index.php on line 6
The thing is that if I echo __DIR__.'/../vendor/autoload.php'; it shows /Applications/MAMP/htdocs/crud_app/public and the vendor directory is outside of public.
This is the path where autoload.php is:
/Applications/MAMP/htdocs/crud_app/controllers/vendor/autoload.php
Any idea what is happening? This is my repo in case you want to look at it. Running PHP 8.1 and macOS. Thanks in advance.
index.php isn't inside controllers, you need to add that to the path.
require_once __DIR__ . '/../controllers/vendor/autoload.php';

iam getting errors as follow Warning: include_once(C:/xampp/htdocs/timetable/header.php): failed to open stream: No such file or directory

Warning: include_once(C:/xampp/htdocs/timetable/header.php): failed to open stream: No such file or directory in C:\xampp\htdocs\timetablegeneratormaster\timetable\index.php on line 4
Warning: include_once(): Failed opening 'C:/xampp/htdocs/timetable/header.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\timetablegeneratormaster\timetable\index.php on line 4
Warning: include_once(C:/xampp/htdocs/timetable/footer.php): failed to open stream: No such file or directory in C:\xampp\htdocs\timetablegeneratormaster\timetable\index.php on line 80
Warning: include_once(): Failed opening 'C:/xampp/htdocs/timetable/footer.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\timetablegeneratormaster\timetable\index.php on line 80
When including files that are in the same directory or to several levels higher or lower than the current file, use the __DIR__ constant to get the path to these files.
If header.php and footer.php are in the same directory as index.php, use this code:
include_once(__DIR__ . "/header.php");
include_once(__DIR__ . "/footer.php");
If they are in a subdirectory, e.g. includes then use the code:
include_once(__DIR__ . "/includes/header.php");
include_once(__DIR__ . "/includes/footer.php");
However, if they were in another place, you use such code:
include_once(__DIR__ . "/../../includes/another.php");
The __DIR__ contains the name of the current directory where the php file is located in which the constant is used.

require_once :failed to open stream: no such file or directory?

I have this testing code
<?php
session_start();
require_once __DIR__ . '/src/Facebook/autoload.php';
$fb = new Facebook\Facebook
My folders structure is this:
http://localhost/facebook.php
If i test this page in a browser i receive:
Warning: require_once(C:\xampp\htdocs/src/Facebook/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\facebook.php on line 3
Fatal error: require_once(): Failed opening required 'C:\xampp\htdocs/src/Facebook/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\facebook.php on line 3
Create a folder named Facebook and put autoload.php inside that folder. What is happening here is your facebook.php file is trying to include/load a file named autoload.php and it can't be found there that's why you are getting this error.

Failed to open stream: No such file or directory in...? PHP Specific

Getting this warning when trying to run my local PHP project (index.php):
Warning: require_once(/Controller/BulletinController.php): failed to open stream: No such file or directory in /Library/WebServer/Documents/WEBB_SERVER/6.2.1x/index.php on line 2
Fatal error: require_once(): Failed opening required '/Controller/BulletinController.php' (include_path='.:') in /Library/WebServer/Documents/WEBB_SERVER/6.2.1x/index.php on line 2
No such file or directory? This is my first 6 rows in index.php:
<?php
require_once ("/Controller/BulletinController.php");
require_once ("/General/MasterPage.php");
require_once ("./General/dbConnection.php");
session_start();
I've tried giving BulletinController.php 777 rights (just developing locally), but no luck.
This is what my structure looks like, so everything is in place:
Thankful for any advice you may have.
require_once ("/Controller/BulletinController.php");
must be
require_once ("Controller/BulletinController.php");
I think you need the whole path:
require_once dirname(__FILE__) . "/Controller/BulletinController.php";

No such file or directory PHP Google Calendar

set_include_path("google-api-php-client/src/google");
require_once 'Client.php';
require_once '/Service/CalendarService.php';
Results in:
Warning: require_once(Google/Auth/AssertionCredentials.php): failed to open stream: No such file or directory in D:\xampp\htdocs\xampp\GoogleCalendar\google-api-php-client\src\Google\Client.php on line 18
Fatal error: require_once(): Failed opening required 'Google/Auth/AssertionCredentials.php' (include_path='google-api-php-client/src/google') in D:\xampp\htdocs\xampp\GoogleCalendar\google-api-php-client\src\Google\Client.php on line 18
Please let me know where I am going wrong.
Assuming I'm in my /home/user/analytics directory (a blank directory) when I download the analytics API through git:
git clone https://github.com/google/google-api-php-client.git
I get these errors when I try to use Client.php. I've modified
/home/user/analytics/google-api-php-client/src/Google/Client.php like so; add four lines before the require lines:
$dirArray = explode('/', dirname(__FILE__));
$homeDir = $dirArray[2];
$path = '/home/' . $homeDir . '/analytics/google-api-php-client/src/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

Categories