Solved

pear path for bluehost subhost

Posted on 2013-06-17
15
738 Views
Last Modified: 2013-06-25
I've been told by one bluehost tech support person that the path to pear for my subhost is:

/usr/share/pear/

but that just gives me a blank page after i submit my form, no errors.

I'm running a script called fpdf that turns form submissions into pdfs. I've beeen using it for years. On the previous server the path to pear was something like:

usr/home/php4/lib/pear/PEAR.PHP

my latest halfbaked idea is this (which doesn't work)

require_once('/usr/share/pear/pear.php');
0
Comment
Question by:phillystyle123
  • 6
  • 5
  • 4
15 Comments
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 290 total points
ID: 39255447
PEAR stands for "PHP Extension and Application Repository" http://pear.php.net/ .  I don't know what you were expecting but in general, there are just add-ons to PHP in PEAR, not display pages.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 210 total points
ID: 39256080
Do you have a cPanel (or similar) or FTP access to the server?  If so you should be able to discern the directory structure and find the repository.

Also, in the unlikely case that your hosting company has given you a PHP4 installation, you may want to ask them to upgrade your account to PHP 5.  PHP 5.4 is current.
0
 

Author Comment

by:phillystyle123
ID: 39257090
Hmm - I wonder why the code I've been running for fpdf uses /pear.php at the end of the path?
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 290 total points
ID: 39257201
A PEAR install on this Windows machine has PEAR.php (note the capitals) but the install on my Linux machine does not.  PEAR.php appears to be class definitions for other PEAR functions.
0
 

Author Comment

by:phillystyle123
ID: 39257239
this was a unix machine - but can you explain:

PEAR.php appears to be class definitions for other PEAR functions.
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 290 total points
ID: 39257271
See for yourself.
PEAR.php
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 210 total points
ID: 39257612
... the code I've been running for fpdf uses /pear.php
I've never seen that.  I've used FPDF extensively and never installed PEAR on any of the servers.  It sounds strange to me.  Maybe you would do well to remove FPDF and re-install it from a fresh download.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:phillystyle123
ID: 39258161
I might try that Ray  -Dave

require_once('/home3/midlang4/public_html/fpdf/pear.php');

I'm getting these errors:

Notice: Only variable references should be returned by reference in /home3/midlang4/public_html/fpdf/Mail_Mime/mime.php on line 356

Warning: Cannot modify header information - headers already sent by (output started at /home3/midlang4/public_html/fpdf/Mail_Mime/mime.php:356) in /home3/midlang4/public_html/follow-up/formpdf.php on line 950
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 210 total points
ID: 39258184
The first is not an error -- it's a Notice.  What level of PHP are you running?  You may be able to suppress this Notice.

The second is not an error -- it's a Warning.  It occurs because the first Notice created browser output.  You might be able to solve the problem here by using ob_start() to collect the browser output and suppress it until the script ends.  A sidebar advantage of ob_start() is that your scripts will run a bit faster.

But something else seems out of whack here.  In my instance of FPDF, I do not have any character string that matches Mail_Mime.
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 290 total points
ID: 39258206
I just downloaded the current version of FPDF and there is no Mail_Mime directory included with it.  It is a PEAR Package  http://pear.php.net/package/Mail_Mime/redirected that someone has added.
0
 

Author Comment

by:phillystyle123
ID: 39261100
Well, this just keeps getting worse. Now I can't generate an error. My script redirects to my thank you page but I don't receive the email (I'm using Mail_Mime to receive email with pdf attachment) in addition to Pear. So, no error, the fpdf script redirects me to my thank you page but I'm not receiving my email. (It's not in spam either).
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 290 total points
ID: 39261261
According to the link above, Mail_Mime is used to create and send email, not receive it.  There is no reason to think that Mail_Mime is installed on your current host.  Here http://pear.php.net/manual/en/installation.shared.php are some instructions for installing your own copy of PEAR so you can then install PEAR packages like Mail_Mime.  I have never tried this so I don't know how difficult it is.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 210 total points
ID: 39262828
...the fpdf script redirects me...
There must be a lot more to the fpdf script than meets the eye!  The FPDF class that I have used does not include redirects, so it appears that maybe someone has extended the class with local code.  Who worked on this script last?
0
 

Accepted Solution

by:
phillystyle123 earned 0 total points
ID: 39263542
Hi All - thanks so much for your help with this! I solved this yesterday with a few tweaks.

First, the path to pear in Bluehost:

- adjusted in the php.ini file I created and placed in the site root
include_path = ".:/usr/lib64/php:/usr/lib/php:/home/username/php"

- adjusted path to pear in two files related to Mail_Mime (which I just installed in my site root - although it is an option to install Mail_Mime via your cpanel in bluehost)
fpdf/Mail.php
require_once '/home/username/php/PEAR.php';
fpdf/Mail_Mime/mime.php
require_once ''/home/username/php/PEAR.php';

After that I discovered that during the site migration the email address I was using in the $from variable no longer existed - so I updated the email address to a valid one:

// email address of the sender
$from = "validemailaddress@mysite.com";

Then it worked! I didn't have to upgrade to the very latest version of fpdf - although I did try that, but it was too much  of a headache for something that was already taking way to long.

Summary for using fpdf with the Mail_Mime class - adjust your path to Pear.php and make sure you're using a valid email address in $from.

This script currently sends an email with a pdf attachment when a form is submitted.
0
 

Author Closing Comment

by:phillystyle123
ID: 39274181
Thanks for the help! The reason I'm using my own answer as the best solution is because it is -in this particular instance.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now