Jump to content

PHP and PEAR troubleshooting


Recommended Posts

Hi

 

I have a website that uses PEAR CAPTCHA.

 

Recently, I got a new dedicated server, with Plesk and the CAPTCHA images no longer work.

 

The server has PHP installed and also has PEAR installed.

 

Please can you help me -- perhaps by suggesting a few things that I can check to troubleshoot this issue?

 

Thanks in advance for your help.

 

Viola

Link to comment
Share on other sites

You'll need to figure out what library PHP was using to generate the CAPTCHAs.

 

 

I would assume that it's GD.

 

Anyway, you'll need to enable (or install) the php_gd extension.

 

Get in a shell as a root user (or use sudo) and do something like:

 

apt-get install php-gd

 

Or

 

yum install php-gd

 

(Depending on your distro)

Link to comment
Share on other sites

Have you checked the error log or turned error reporting on?

 

I figured it was GD, but I guess not, so finding the error reported will be a bit faster than guessing.

 

 

My second guess though, is that TTF support isn't in PHP on your box.

Link to comment
Share on other sites

Corbin -- Error logging is turned on, but I'm not sure where to look to find the log.

 

Thorpe -- the CAPTCHA worked fine until the server was upgraded.

 

The website has a PEAR directory that contains CAPTCHA.  The server has PHP and PEAR installed.  I think that I need to somehow link them together (perhaps some sort of paths definition or something?).

Link to comment
Share on other sites

http://pear.php.net/manual/en/installation.php

 

PEAR is not installed by default, so I bet when the server was upgraded, PEAR is no longer installed.  Don't know why I didn't think of that >.<.

 

The error log is in different places for different systems.  I'm sure it would be in the Apache log, but no idea where that is either on your system.  You could try looking in /var/log/ for Apache looking files.

 

 

 

Link to comment
Share on other sites

The website has a PEAR directory that contains CAPTCHA.  The server has PHP and PEAR installed.  I think that I need to somehow link them together (perhaps some sort of paths definition or something?).

 

You need to put the directory containing the PEAR directory within your include_path (within your php.ini). eg; If pear is within /usr/share/php/pear you need to add /usr/share/php to your include_path directive (if its not already set).

Link to comment
Share on other sites

My server is with GoDaddy and I asked their support.  They said that PEAR is installed.  Doing find, finds a PEAR installation in /usr/share/pear.  Typing "pear" on the command line causes a list of pear commands to be listed.

 

I did yum list php-gd and found that php-gd.i386 is installed.

 

Thorpe -- thanks.  I've already done this.  I've tried setting the path to /usr/share and I've tried /usr/share/pear.

Link to comment
Share on other sites

I suggest finding the error log then...

 

You could enable error output in PHP (add to the top of the page):

 

error_reporting(E_ALL);

ini_set('display_errors', '1');

 

Or, you could find the error log:

 

find . -name error_log

 

Or:

 

find . -name httpd.conf

 

(or maybe apache.conf)

 

Then:

 

grep ^ErrorLog <file returned from find>

Link to comment
Share on other sites

Hi

 

Thanks for the suggestions.

 

I found the error log under /var/log/httpd/error_log, but it didn't seem to have any relevant errors in it (the only error said [error] (9)Bad file descriptor: apr_socket_accept: (client socket)) -- not sure what this is, but it doesn't look relevant -- please say if you think otherwise).

 

I also added error reporting to a test page:

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once 'System.php';
var_dump(class_exists('System'));
?>

 

The errors I got are:

 

Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in /earlier_parts_of_path/httpdocs/System.php on line 26

 

Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.:/usr/share/pear/') in /earlier_parts_of_path/httpdocs/System.php on line 26

 

This seems to indicate that my include_path is wrong.  However, I have tried:

/usr/share

/usr/share/pear

/usr/share/pear/

 

I don't think that I should have to include my httpdocs path in the include_path directive, should I?

 

However ...

 

Another thing that I have noticed is that I do not have go-pear (used find . -name go-pear).  I haven't yet found an explanation of what exactly this does.  Looking at what I can find, it seems to be related to using PEAR as part of a website.  Do you think that this may have anything to do with it?

 

Viola

Link to comment
Share on other sites

Another thing that I have noticed is that I do not have go-pear (used find . -name go-pear).  I haven't yet found an explanation of what exactly this does.  Looking at what I can find, it seems to be related to using PEAR as part of a website.  Do you think that this may have anything to do with it?

 

go-pear is a batch file used to install pear on windows machines. It is not required at runtime.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.