Connecting MySQL to php files (pear error) - php

Warning: require_once(book/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\book\book.php on line 48
Fatal error: require_once(): Failed opening required 'book/autoload.php' (include_path='C:\xampp\php\PEAR;;/book;/book/classes;/book/pear/PEAR') in C:\xampp\htdocs\book\book.php on line 48
I added this to the file:
require_once('book/autoload.php');
include_path('C:\xampp\php\PEAR;;/book;/book/classes;/book/pear/PEAR');
This is very rudimentary, but it's still not working. Have mercy, this is my first php project.

You can try this
require_once('book/autoload.php');
and must check that your folder path is correct.

Related

php fatal error when I try php artisan serve

Hello guys please I suddenly have this error when I try php artisan command on my laravel project
PHP Warning: require_once(H:\cryptoblockspot/bootstrap/app.php): failed to open stream: No such file or directory in H:\cryptoblockspot\artisan on line 20
Warning: require_once(H:\cryptoblockspot/bootstrap/app.php): failed to open stream: No such file or directory in H:\cryptoblockspot\artisan on line 20
PHP Fatal error: require_once(): Failed opening required 'H:\cryptoblockspot/bootstrap/app.php' (include_path='C:\xampp\php\PEAR') in H:\cryptoblockspot\artisan on line 20
Fatal error: require_once(): Failed opening required 'H:\cryptoblockspot/bootstrap/app.php' (include_path='C:\xampp\php\PEAR') in H:\cryptoblockspot\artisan on line 20
Please Guys I need help on this thanks in advance
Basically it is not finding the file:
H:\cryptoblockspot/bootstrap/app.php
Check if it exists and the system has access permission

Warning: require_once(/home/orgdevelopers.tk/public_html/ok/app/Config/constant.php): failed to open stream: No such file or directory in

You can see the error on http://orgdevelopers.tk/api/app/Config/core.php
my php version is 7.0.33.
I am getting this error when I execute my PHP file. Please help.
{Warning: require_once(/home/orgdevelopers.tk/public_html/ok/app/Config/constant.php): failed to open stream: No such file or directory in /home/orgdevelopers.tk/public_html/ok/core.php on line 3
Fatal error: require_once(): Failed opening required '/home/orgdevelopers.tk/public_html/ok/app/Config/constant.php' (include_path='.:/usr/local/lsws/lsphp70/share/pear:/usr/local/lsws/lsphp70/share/php:/usr/share/pear:/usr/share/php') in /home/orgdevelopers.tk/public_html/ok/core.php on line 3}
core.php line 3 is== require_once('app/Config/constant.php');
If both files reside in same directory, The path of constant.php in require_once function in core.php should be constant.php or /api/app/Config/constant.php or __DIR__.'/constant.php' instead of app/Config/constant.php

Laravel not working in terminal

I had laravel all set up on my computer and everything was working great, then they released version 5.5 and things didn't work for me anymore. When I type laravel in my terminal I get:
PHP Warning: require(/Users/logan/.composer/vendor/composer/../guzzlehttp/psr7/src/functions_include.php): failed to open stream: No such file or directory in /Users/logan/.composer/vendor/composer/autoload_real.php on line 66
Warning: require(/Users/logan/.composer/vendor/composer/../guzzlehttp/psr7/src/functions_include.php): failed to open stream: No such file or directory in /Users/logan/.composer/vendor/composer/autoload_real.php on line 66
PHP Fatal error: require(): Failed opening required '/Users/logan/.composer/vendor/composer/../guzzlehttp/psr7/src/functions_include.php' (include_path='.:') in /Users/logan/.composer/vendor/composer/autoload_real.php on line 66

PHP Fatal error: require()

I have a website that works perfect in my localhost with xampp, but... I uploaded it to a few free websites hosting (000webhost and hostinger) and when i try to open it, got this message:
Warning: require(core/libs/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/u327900732/public_html/www/index.php on line 7
Fatal error: require(): Failed opening required 'core/libs/smarty/Smarty.class.php' (include_path='.:/opt/php-5.5/pear') in /home/u327900732/public_html/www/index.php on line 7
This is the code:
<?php
session_start();
$view = isset($_GET['view']) ? $_GET['view'] : 'index';
require_once('core/libs/smarty/Smarty.class.php');
require('core/models/class.Conexion.php');
if(file_exists('core/controllers/'.$view.'Controller.php')){
include('core/controllers/'.$view.'Controller.php');
}else {
include('core/controllers/errorcontroller.php');
}
?>
I checked that file one hundred times and it is there.
I found and tried this solutions:
Changing Require for Include:
Warning: include(core/libs/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/u327900732/public_html/www/index.php on line 7
Warning: include(): Failed opening 'core/libs/smarty/Smarty.class.php' for inclusion (include_path='.:/opt/php-5.5/pear') in /home/u327900732/public_html/www/index.php on line 7
Fatal error: Class 'Smarty' not found in /home/u327900732/public_html/www/core/controllers/indexController.php on line 3
require(chdir(dirname(FILE)) . 'core/libs/smarty/Smarty.class.php');
Warning: require(1core/libs/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/u327900732/public_html/www/index.php on line 7
Fatal error: require(): Failed opening required '1core/libs/smarty/Smarty.class.php' (include_path='.:/opt/php-5.5/pear') in /home/u327900732/public_html/www/index.php on line 7
Changing line 7 for
require_once($_SERVER['DOCUMENT_ROOT'].'/core/libs/smarty/Smarty.class.php');
Warning: require_once(/home/u327900732/public_html/core/libs/smarty/Smarty.class.php): failed to open stream: No such file or directory in /home/u327900732/public_html/www/index.php on line 7
Fatal error: require_once(): Failed opening required '/home/u327900732/public_html/core/libs/smarty/Smarty.class.php' (include_path='.:/opt/php-5.5/pear') in /home/u327900732/public_html/www/index.php on line 7
I tried adding './' to the path but it still doesn't work. I repeat, the site works perfect in my localhost. Help please!
Trying to use complete url to test your url. Or check in your browser to check the file exist or not. Like here:
http://host.com/core/libs/smarty/Smarty.class.php
I think it will show error that show your file isn't exist there.

link path solution in localhost environment: http:// wrapper is disabled in the server configuration by allow_url_include=0

I have seen this question asked and answered many times, but I can't seem to get a solution for myself
Here is my basic folder structure:
http://localhost/cms/
To grab all my code I have a utilities file located here:
http://localhost/cms/includes/utilities.inc.php
and within that file I have requires()s to include classes, as such:
require('classes/Post.php');
require('classes/User.php');
require('classes/Comments.php');
require('classes/Category.php');
when I try and include my http://localhost/cms/includes/utilities.inc.php file into the following directory it doesn't work! http://localhost/cms/admin/
when I try I get this error:
Warning: require(classes/Post.php): failed to open stream: No such file or directory in C:\xampp\htdocs\cms\includes\utilities.inc.php on line 12
Fatal error: require(): Failed opening required 'classes/Post.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\cms\includes\utilities.inc.php on line 12
When Using Absolute Paths In My Utility File:
require('http://localhost/cms/classes/Post.php');
require('http://localhost/cms/classes/User.php');
require('http://localhost/cms/classes/Comments.php');
require('http://localhost/cms/classes/Category.php');
I get the following error:
Warning: require(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in C:\xampp\htdocs\cms\includes\utilities.inc.php on line 12
Warning: require(http://localhost/cms/classes/Post.php): failed to open stream: no suitable wrapper could be found in C:\xampp\htdocs\cms\includes\utilities.inc.php on line 12
Fatal error: require(): Failed opening required 'http://localhost/cms/classes/Post.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\cms\includes\utilities.inc.php on line 12
How can I get a system that will link properly (preferably WITHOUT anything PEAR related)?

Categories