Probably a really daft question...

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

harryajh
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Nov 27, 2012 1:33 am

Probably a really daft question...

Postby harryajh » Tue Nov 27, 2012 1:36 am

but I'm a newbie to PHP and I want to be able to use the Zend library in my website to use the openID functionality but just can't get it to work.

I have the following structure -

$HOME/public_html/php.ini
$HOME/public_html/l.php
$HOME/public_html/zf/library/Zend/... Zend stuff

Where $HOME = /home1/mydomain (obviously replaced last bit)

default php.ini -
######################################################################
.....
include_path = ".:/usr/lib64/php:/usr/lib/php:/usr/share/pear"
.....
######################################################################

1.php -

######################################################################
<?php
$status = "";
if (isset($_POST['openid_action']) && $_POST['openid_action'] == "login" && !empty($_POST['openid_identifier'])) {
$consumer = new Zend_OpenId_Consumer();
if (!$consumer->login($_POST['openid_identifier'])) {
$status = "OpenID login failed.";
}
} else if (isset($_GET['openid_mode'])) {
if ($_GET['openid_mode'] == "id_res") {
$consumer = new Zend_OpenId_Consumer();
if ($consumer->verify($_GET, $id)) {
$status = "VALID " . htmlspecialchars($id);
} else {
$status = "INVALID " . htmlspecialchars($id);
}
} else if ($_GET['openid_mode'] == "cancel") {
$status = "CANCELLED";
}
}
?>
<html><body>
<?php
echo "$status<br>";
?>
<form method="post">
<fieldset>
<legend>OpenID Login</legend>
<input type="text" name="openid_identifier" value=""/>
<input type="submit" name="openid_action" value="login"/>
</fieldset>
</form>
</body></html>
<?php
phpinfo();
?>
######################################################################

I believe the problem is the include_path not being set correctly but tried all variations I can think of (listed below and verified using phpinfo() at bottom of script) but I always get the same error in the logs -

PHP Fatal error: Class 'Zend_OpenId_Consumer' not found in /home1/mydomain/public_html/l.php on line 4 ($consumer = new Zend_OpenId_Consumer();)

tried -
include_path = ".:/usr/lib64/php:/usr/lib/php:/usr/share/pear:zf/library/Zend"
include_path = ".:/usr/lib64/php:/usr/lib/php:/usr/share/pear:/public_html/zf/library/Zend"
include_path = ".:/usr/lib64/php:/usr/lib/php:/usr/share/pear:/home1/mydomain/public_html/zf/library/Zend"


Now I'm totally stumped, probably something really stupid as usual, but really can't see it?

If it makes any difference I'm using JustHost.com

thanks in advance

harryajh
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Nov 27, 2012 1:33 am

Re: Probably a really daft question...

Postby harryajh » Tue Nov 27, 2012 7:06 am

have I posted this on the wrong forum (or maybe just of load of complete gibberish) - if so, can someone please tell me

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Probably a really daft question...

Postby seandisanti » Tue Nov 27, 2012 9:08 am

It looks like you posted to the correct forum, but reading through to spot the issue and the cause is a little messy because of the way your settings and your commentary kind of blend together. you can use [ code ] or [ quote ] (without spaces) to separate the two and that should help readability. I am reading through it right now and will help if i'm able

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Probably a really daft question...

Postby seandisanti » Tue Nov 27, 2012 9:18 am

Open the file and see if you can find the class. I have been working with the google analytics api lately and ran into errors with their sample code because they referenced a class apiClient that had apparently been changed to Google_Client. I argued with the include path for a while before actually getting in and realizing that the issue was with the documentation not the path.

harryajh
New php-forum User
New php-forum User
Posts: 3
Joined: Tue Nov 27, 2012 1:33 am

Re: Probably a really daft question...

Postby harryajh » Wed Nov 28, 2012 12:16 am

thanks for your reply, checked the class name and is identical, so assuming one of those include_paths are correct I'm now at the point of giving up with Zend and finding a different library.

Thanks anyway


Return to “PHP Installation”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron