(include_path='.;C:\php\pear')
Posted by: BrooksyFC (---.19-3.cable.virginm.net)
Date: February 18, 2016 05:05PM

Hi there,

Im trying to make a website using phpmyadmin and I am having this error pop up all the time. The code is working to a degree but this error keeps appearing.

Warning: include(init.php): failed to open stream: No such file or directory in C:\wamp\www\Functions\Login.php on line 2

Warning: include(): Failed opening 'init.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\Functions\Login.php on line 2

Anyone have any ideas on how to overcome this?

Options: ReplyQuote
Re: (include_path='.;C:\php\pear')
Posted by: FakE (---.dynamic.kabel-deutschland.de)
Date: February 18, 2016 05:20PM

Quote

Warning: include(): Failed opening 'init.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp\www\Functions\Login.php on line 2

The include path isn't correct.

False
include_path='.;C:\php\pear'
Right
include_path='C:\php\pear'

You need to correct this in the php.ini
Are you sure the written path is correct? Is there a php folder in C:\ ?



Edited 2 time(s). Last edit at 02/18/2016 06:02PM by FakE.

Options: ReplyQuote
Re: (include_path='.;C:\php\pear')
Posted by: BrooksyFC (---.19-3.cable.virginm.net)
Date: February 18, 2016 05:30PM

Thanks for the reply.

This is what my Login.php file looks like:

<?php
include 'init.php';

if (empty($_POST) === false) {
$username = $_POST['username']; //username & password equals posted values
$password = $_POST['password'];

if (empty($username) || empty($password)) { //if username or password is empty
echo "You need to enter a Username and Password";
} else if(user_exists($username) === false) { //checking is the user exists and calls user_exists function
echo "That Username exists. Have you already registered?";
}
}
?>

And this is what the init.php file is:

<?php
session_start();

require 'Database/Connect.php';
require 'Functions/General.php';
require 'Functions/Users.php';

?>

Options: ReplyQuote
Re: (include_path='.;C:\php\pear')
Posted by: Otomatic (Moderator)
Date: February 18, 2016 05:57PM

Hi,

> Failed opening 'init.php' for inclusion (include_path='.;C:\php\pear')

Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include will finally check in the calling script's own directory and the current working directory before failing.
What makes the error generated if the file is not found, give the value of include_path but as the include path is not defined in php.ini and the default value is:
PHP's default setting for include_path is ".;/path/to/php/pear"

So, as include 'init.php'; as a warning, il indicates that the file init.php does not exist in the same folder as Login.php.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: (include_path='.;C:\php\pear')
Posted by: BrooksyFC (---.19-3.cable.virginm.net)
Date: February 18, 2016 06:04PM

Thank you I have sorted that now. Im having some other trouble with mysqli. Do i need to make another post on that?

Options: ReplyQuote
Re: (include_path='.;C:\php\pear')
Posted by: Otomatic (Moderator)
Date: February 18, 2016 06:15PM

Hi,

> Do i need to make another post on that?
It would be preferable indicating an explicit title.
And, please, answer to READ BEFORE YOU ASK A QUESTION because the answer to your problems may depend on what you use.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: (include_path='.;C:\php\pear')
Posted by: RiggsFolly (Moderator)
Date: February 18, 2016 06:15PM

Yes please

Dont forget to start the new post with the answers from this post [forum.wampserver.com]

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: (include_path='.;C:\php\pear')
Posted by: Otomatic (Moderator)
Date: February 18, 2016 06:38PM

Hi,

@RiggsFolly : I gained a tenth of a second winking smiley

Options: ReplyQuote
Re: (include_path='.;C:\php\pear')
Posted by: RiggsFolly (Moderator)
Date: February 18, 2016 07:30PM

@FakE

The fact you want to help out on this forum is GREAT. But please think about your answers.

The parameter :

include_path='.;C:\php\pear'

Is NOT wrong. And is the default in the php.ini file, which we do not amend as part of our install.
.
The dot, indicates CURRENT DIRECTORY, which is always useful, and intended.

The fact that the folder mentioned is not found is nothing to do with the actual problem in this case

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.