The error in question:
[RuntimeException]
Error Output: PHP Warning: require(/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php): failed to open stream: N
o such file or directory in /home/admin/web/"webpage"/public_html/test/vendor/composer/autoload_real.php on line 58
PHP Stack trace:
PHP 1. {main}() /home/admin/web/"webpage"/public_html/test/artisan:0
PHP 2. require() /home/admin/web/"webpage"/public_html/test/artisan:16
PHP 3. require() /home/admin/web/"webpage"/public_html/test/bootstrap/autoload.php:17
PHP 4. ComposerAutoloaderInit95cd02d44d232a8b8d6e5e52544d8647::getLoader() /home/admin/web/"webpage"/public_html/test/vendor
/autoload.php:7
PHP 5. composerRequire95cd02d44d232a8b8d6e5e52544d8647() /home/admin/web/"webpage"/public_html/test/vendor/composer/autoload
_real.php:49
PHP Fatal error: require(): Failed opening required '/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php' (includ
e_path='/home/admin/web/"webpage"/public_html/test/vendor/phpunit/php-text-template:/home/admin/web/"webpage"/pub
lic_html/test/vendor/phpunit/php-timer:.:/usr/share/pear:/usr/share/php') in /home/admin/web/"webpage"/public_html/test/vendor
/composer/autoload_real.php on line 58
PHP Stack trace:
PHP 1. {main}() /home/admin/web/"webpage"/public_html/test/artisan:0
PHP 2. require() /home/admin/web/"webpage"/public_html/test/artisan:16
PHP 3. require() /home/admin/web/"webpage"/public_html/test/bootstrap/autoload.php:17
PHP 4. ComposerAutoloaderInit95cd02d44d232a8b8d6e5e52544d8647::getLoader() /home/admin/web/"webpage"/public_html/test/vendor
/autoload.php:7
PHP 5. composerRequire95cd02d44d232a8b8d6e5e52544d8647() /home/admin/web/"webpage"/public_html/test/vendor/composer/autoload
_real.php:49
Background: Was developing locally, got to the point where I wanted to have a staging site. Set up the staging site on digital ocean (entOS 6.5 x64). I then cloned my git repo into my desired folder - configured vhosts DefaultDirectory to my public path.
A default installation works, composer update/install works. However, with my cloned repository I am getting said error. '/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php' is a file I made with some helper methods I could use in various controllers. It has not caused any problems locally. I can composer update/install locally, without any problems.
Any guidance would be greatly appreciated!
Are those literal quotation marks in your file path
/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php
Or are you just using that to indicate your website name normally goes there? If the former, I'd consider not doing that as it's pretty weird to have quotes in unix file names, and you may run into problems based on assumptions other people have made.
Regardless -- you have the information you need
[RuntimeException] Error Output: PHP Warning: require(/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php): failed to open stream: N o such file or directory in /home/admin/web/"webpage"/public_html/test/vendor/composer/autoload_real.php
PHP is telling you it tried to require in a specific file
/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php
but it could not find it ("failed to open stream"). This means either the file doesn't exist on the computer you're trying to load it from, or PHP can't see it for some reason (try dumping the results of is_readable('/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php'); to see if PHP thinks it can read the file or not.
Related
When creating a scheduled task to run a php script in Plesk Onyx on windows it results in an error.
However when i run the same script in the browser it works without any issues.
I have been looking for the permission settings in the webroot and set them to allow access to all user groups on the server.
The error i get is the following:
Warning: require(\pcp2\inc\db_config.php): failed to open stream: No such file or directory in D:\www\domain\pcp2\conversion\addBooking.php on line 5
Fatal error: require(): Failed opening required '\pcp2\inc\db_config.php' (include_path='.;.\includes;.\pear') in D:\www\domain\pcp2\conversion\addBooking.php on line 5
Line 5 contains the following info:
require($_SERVER['DOCUMENT_ROOT']."\pcp2\inc\db_config.php");
It's failing becasue $_SERVER['DOCUMENT_ROOT'] is a value provided by the web server, and is thus undefined when run without a web server (i.e., from the command line.) You'll need to provide an alternative mechanism to set the base directory.
You might use relative paths:
require("pcp2\inc\db_config.php");
Or absolute paths based on the magic constant __DIR__. (This assumes the script doing the require'ing is in the document root directory.)
require(__DIR__."\pcp2\inc\db_config.php");
Ideally however, you're better off using PSR-4 namespacing with an autoloader.
I'm getting this error when my site is online
[host www.sitename.com] Backend fatal error: PHP Fatal error: require_once() [function.require]: Failed opening required 'admin/config/connection.php' (include_path='.:/opt/cpanel/ea-php53/root/usr/share/pear:/opt/cpanel/ea-php53/root/usr/share/php') in /home/mistrybu/public_html/index.php on line 373\n
The site works well in localhost but when its put online , the dynamic part is not showing.
I changed the php version from php7 to php5 in cpanel. Now the front end is working but the backend is not.
Can someone help me solve this error?
PHP version
Definitely do not go back to PHP5. Keep it to 7. If that means rewriting some of the existing code, so be it, it will make your site more secure and more future proof.
Error Message
Your require_once() method cannot find or access a particular file. This is most probably because:
File missing
The file (connection.php) doesn't exist in the given location (admin/config). Now keep in mind that as the location doesn't start with a /, it's going to be relative to where the require_once() method is being run from.
Since you're running require_once() from:
home/mistrybu/public_html/
it's going to look for the file here:
/home/mistrybu/public_html/admin/config/.
Does that location exist? Does the connection.php reside in the folder?
Folder mismatch
Try adding the following prefix to your path, and see if that makes a difference:
require_once $_SERVER['DOCUMENT_ROOT'].'/admin/config/connection.php';
File errors
Maybe the file exists, but for some reason, gives an error. Try running the following from your command line and see if you get any errors:
php -f admin/config/connection.php
I want To run a symfony project in my computer but I get all times errors , and now I get this error and i didn't find any solution for my problem
Problem Failed to parse output as xml: Error on line 2: Content is not
allowed in prolog.. Command C:\xampp\php\php.exe
C:\xampp\htdocs\buzzaka\bin\console list --format=xml Output
Fatal error: Uncaught
Symfony\Component\Dotenv\Exception\PathException: Unable to read the
"C:\xampp\htdocs\buzzaka\bin/../.dev.env" environment file. in
C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php:466 Stack
trace:
0 C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php(51): Symfony\Component\Dotenv\Dotenv->doLoad(false, Array)
1 C:\xampp\htdocs\buzzaka\bin\console(38): Symfony\Component\Dotenv\Dotenv->load('C:\xampp\htdocs...')
2 {main} thrown in C:\xampp\htdocs\buzzaka\vendor\symfony\dotenv\Dotenv.php on line 466
If u move your file from the folder where it was created symfony will keep looking for it on this folder, i've went on autoload_runtime and changed on $runtime variable where the project is, just worked for me, lets see on the last composer dump what just happens haha
The error is quite explicit, do you have a file C:\xampp\htdocs\buzzaka\bin/../.dev.env ?
Well, you need to create one. As announced a little while ago, Symfony will now require a .env file per environment. As you are running your command in the dev environment, you need to create a .dev.env file.
I have recently been trying to add PHPMailer script to my site, following the accepted answer from here:
Send attachments with PHP Mail()?
I have never used a require statment before so I assume I must be doing it wrong, currently testing on my local host version of the site. I have downloaded the entire zip of git (unzipped it) and moved it to the dir my scripts are in.
In my script I added the following line:
require_once(__DIR__.'/PHPMailer-master/class.phpmailer.php');
Which to my understanding was all I needed to do to use it. However I get this error:
Warning:
require_once(C:\xampp\htdocs\Website\PHPMailer-master\class.phpmailer.php):
failed to open stream: No such file or directory in
C:\xampp\htdocs\Website\include\mailer.php on line 10
Fatal error: require_once(): Failed opening required
'C:\xampp\htdocs\Website\PHPMailer-master\class.phpmailer.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\Website\include\mailer.php on line 10
Any ideas what is causing this error? Am running PHP 5.6.21 if this is relevant.
Try to use the full path to the file, using realpath() - http://php.net/realpath, and use dirname(__FILE__) to get your current directory:
Recently, I formated my whole computer, and installed Windows 7 64-bit. Before doing that I saved all of my files on an external hard drive. One of the things I backed up was a PHP script which uses AWS DynamoDB Services.
Before I formated my computer, everything went perfect. After I formated it, I installed on it XAMPP, Visual Studio Code, and PHP 7.1.1 through Microsoft WebPI.
Currently when I'm trying to run my PHP script I get this error on my screen:
Warning: require(/zip/aws/aws-autoloader.php): failed to open stream: No such file or directory in D:\Users\Lenovo\xampp\htdocs\public_html\file.php on line 7
Fatal error: require(): Failed opening required '/zip/aws/aws-autoloader.php'(include_path='D:\Users\Lenovo\xampp\php\PEAR') in D:\Users\Lenovo\xampp\public_html\file.php on line 7
I'm calling the autoloader this way:
require '/zip/aws/aws-autoloader.php';
I'm trying to understand if I forgot to install another thing, or if it's something related to the system (I had Windows 10 before)...
Could you please help me figure it out? I'm pretty new to this topic of PHP...
You should specify the entire path, like this: require __DIR__ . '/zip/aws/aws-autoloader.php';