0

Hello,

Can anyone help me cek this filepath :

$bannerAdsPath = 'localhost/phpads/install.php';
require 'localhost/phpads/install.php';

Is it correct how I wrote it?

This error appears:

Warning: require(localhost/phpads/install.php) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\phpads\admin.php on line 6

Fatal error: require() [function.require]: Failed opening required 'localhost/phpads/install.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\phpads\admin.php on line 6

Edited by davy_yg

6
Contributors
7
Replies
19
Views
5 Years
Discussion Span
Last Post by albucurus
0

<?php require 'localhost/phpads/install.php'; ?>

this simply shows that you donot have the file in that directory, whcih you are giving path of.

check the spellings of the actual file and compare. Are you sure that the file is in the directory?

0

yes, I do have the file.

I wonder if I wrote the file path correctly (basically it's in localhost/phpads/install.php)

how to write it? Is it like this:

<?php require 'xampp/htdocs/phpads/install.php'; ?>

Edited by davy_yg

0

require 'localhost/phpads/install.php' is relative to your current file path so this would load C:\xampp\htdocs\phpads\localhost\phpads\install.php

You need the leading slash require '/localhost/phpads/install.php';

0

I think you are confusing two file system types; localhost is for the browser address bar and relates to hostnames, but the script needs the system path. If 'install.php' is in the same directory, then you can try './install.php' (./ is shorthand for this directory). You need to give the relative system path from the file that uses the require() to the required file itself, or you can give an absolute path: 'C:\xampp\htdocs\phpads\install.php'

0

Here is my revision:

$bannerAdsPath = '/localhost/phpads/ads.dat';
require('/localhost/phpads/ads.inc.php');

and still get this error message:

Warning: require(/localhost/phpads/ads.inc.php) [function.require]: failed to open stream: No such file or directory in C:\xampp\htdocs\phpads\admin.php on line 6

Fatal error: require() [function.require]: Failed opening required '/localhost/phpads/ads.inc.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\phpads\admin.php on line 6

the file is truely there.

0

hey i had the same issue and this is how i resolved it
$bannerAdsPath = '../phpads/ads.dat';
require('../phpads/ads.inc.php');

Hope its helps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.