hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : including a php file gives me an error. Not when include() through HTTP
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

including a php file gives me an error. Not when include() through HTTP

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 03-26-2002, 05:40 PM
Domenico Domenico is offline
Premium Member
 
Join Date: Dec 2000
Location: Lowlands
Posts: 716
*

including a php file gives me an error. Not when include() through HTTP


Hi all!

When I try to include a php file like this:
<?
require "file.php";
?>
I get this error:
Fatal error: Failed opening required file.php'
(include_path='.:/usr/share/php') in /home/test/public_html/file.php on line 1


But when I do it like this:
<?
require "http://mydomain.com/file.php";
?>
it works!

Why is this? I can't figure out why because on some clients it does work both ways.
What is configured wrong here?

Thank you,
Domenico

Reply With Quote


Sponsored Links
  #2  
Old 03-26-2002, 06:53 PM
MGCJerry MGCJerry is offline
is useless
 
Join Date: Jan 2002
Location: USA
Posts: 3,004
Quote:
<?
require "file.php";
?>
Not that I'm, a php expert, but try this...

PHP Code:
<? 
require ('file.php'); 
?>
Well... it works fine for me....

hope this helps a little....

__________________
Don't like what I say? Ignore me because it will be the only way you can shut me up.

Reply With Quote
  #3  
Old 03-26-2002, 07:31 PM
Shyne Shyne is offline
Registered User
 
Join Date: Mar 2002
Posts: 1,003
Check your php.ini file and make sure that "include_path" has no entry next to it.

Reply With Quote
Sponsored Links
  #4  
Old 03-26-2002, 07:32 PM
Domenico Domenico is offline
Premium Member
 
Join Date: Dec 2000
Location: Lowlands
Posts: 716
Nope, I allready tried that one
It gives me the same error.

Anyone else?

Reply With Quote
  #5  
Old 03-26-2002, 07:40 PM
Domenico Domenico is offline
Premium Member
 
Join Date: Dec 2000
Location: Lowlands
Posts: 716
Before there was .:/usr/share/php behind it but I removed it and restarted apache and now the error is:

Fatal error: Failed opening required 'd_projects.php?show=10' (include_path='') in /home/test/public_html/file.php on line 2


Reply With Quote
  #6  
Old 03-27-2002, 03:53 AM
kunal kunal is offline
Web Hosting Master
 
Join Date: Aug 2000
Posts: 2,750
um... are you sure the file exists in the same dir as the script??

__________________
The Php Support Desk
http://www.phpsupportdesk.com
Custom programming - kunal @ e-phoria.com
http://www.pingzine.com - Ping!Zine. the FREE, FRESH and EXCITING Web Hosting Magazine...

Reply With Quote
  #7  
Old 03-27-2002, 05:16 AM
Domenico Domenico is offline
Premium Member
 
Join Date: Dec 2000
Location: Lowlands
Posts: 716
Yes, it's in the same dir.

Reply With Quote
  #8  
Old 03-27-2002, 05:37 AM
Domenico Domenico is offline
Premium Member
 
Join Date: Dec 2000
Location: Lowlands
Posts: 716
Let me rephrase my problem because I forgot to mention something.

What I want to use but doesn't work is:
<?
require "file.php?show=10";
?>

This works now:
<?
require "file.php";
?>

So why is this then?

Reply With Quote
  #9  
Old 03-27-2002, 06:02 AM
jamesl jamesl is offline
New Member
 
Join Date: Mar 2002
Location: UK
Posts: 2
Hi,

You cannot include/require a file with any parameters passed to it directly as php looks for a file called "file.php?show=10" rather than just "file.php".

If show is not already defined in your script change it to the following:

<?
$show=10;
require "file.php";
?>

And it will be included correctly as file.php can see the variable as it is already defined in the script, note this only works for direct includes and not using includes via http:// for which you should use:

<?
require "http://mydomain.com/file.php?show=10";
?>

HTH

Reply With Quote
  #10  
Old 03-27-2002, 06:10 AM
Domenico Domenico is offline
Premium Member
 
Join Date: Dec 2000
Location: Lowlands
Posts: 716
Thanks for telling Jamesl!

I thought of this but didn't tried it yet, stupid me

Anyways, this is what the manual says:
- To include the top downloaders, sorted by number of reviews and rating (greatest to least), insert this where you would like the top downloaders to appear: <? require "d_top.php?show=xx"; ?> Replace "xx" with the number of top "downloaders" to display.

hehehe, someone has to go back to school then

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
File Sync Software Provider ownCloud Secures $2.5M Funding Round to Grow Partner Channel Web Hosting News 2012-11-26 14:20:54
Court Documents Show Megaupload Helped Feds Take Down File Sharing Service NinjaVideo Web Hosting News 2012-11-21 10:53:49
File Sharing Service RapidShare Changes Traffic Model to Deter Piracy Web Hosting News 2012-11-09 12:16:35
SingleOS Launches Fuscan Linux Cloud 2.0 Web Hosting News 2011-08-12 19:09:05
Security Firm Trustwave Launches Cloud-Based File Integrity Monitor Web Hosting News 2011-06-21 18:47:57


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?