tags:

views:

86

answers:

4

Hi,

I am new to php. I thought I knew enough but apparently do not. I am trying to use the OAuth.php from code.google.com. So I include OAuth.php in my code.

Here is my php file - index.php

<?php

print 'Hello1';
include 'test.php';
print 'Hello2';
include 'OAuth.php';
print 'Hello3';


?>

Here test.php, OAuth.php and index.php are all in the same directory.

Amazingly enough, I see Hello1 and Hello2 but not Hello3. What am I missing. Its driving me crazy. Any help is greatly greatly appreciated. I am using php5 with apache 2.2 and also have the oauth.so module installed and loaded from php.net.

  • SV
+1  A: 

First off,configure your php.ini so that PHP will give you decent warnings and errors so you can figure out whats going on.

Second, I'm a bit rusty on PHP but I don't think you include something to use it in your application unless it is physically in your filesystem. So, you should be able to use OAuth without doing the include bit.

Earlz
A: 

I'd suggest your OAuth.php file has a bug in it.

bmb
A: 

Put:

error_reporting(-1);
ini_set('display_errors',1);

at the top of your script to begin with. That turns on all possible warnings/notices. It should be obvious at that point. You should also use relative includes to save a sys-call. As in:

include './OAuth.php';

If your OAuth.php file is in the same directory as your script.

Rasmus
A: 

Thanks for the suggestions. Right when I was about to submit my question I realized that I also had the oauth php extension installed. Based on the suggestion that I need to look at the log files (which I somehow completely forgot about), I looked and sure enough, the class declared in OAuth.php is conflicting with the one in the oauth.so extension. That was why it was failing on that line.

Thanks Rasmus for the suggestions to show more warnings. I will try them out.