Jump to content
Larry Ullman's Book Forums

Chapter 9 - Installing Html_Quickform2


Recommended Posts

I believe that I installed html_QuickForm2 correctly on my mac, version 10.6, but I still get an error stating the file doesn't exist, any suggestions. And how can I check to see if pear is installed on my computer ( I presume that it is). i am presently using mamp pro 2.0.5. 

Link to comment
Share on other sites

This problem is related to packages and your include path. As you see from your error message, the file does not exists at your include_path. When you require/include files, PHP will check several places for that file if it's not found. When it can't find QuickForm2.php inside the folder named "HTML", it'll then check your include path. That's why you get that message there.

 

If you turn on "view hidden files" on your computer, go do your C drive, then navigate through the folders /usr /local /pear /share /pear, that's where you computer expects the Pear package to be downloaded at. You might do one of several things to fix the problem:

 

1. Change include_path in php.ini: (Recommended)

- Find your php.ini file and change the include_path variable to where the HTML QuickForm package is located.

 

2. Change include_path with ini_set()

- Add this line before you include something. It'll change your include path temporarily for that script.

ini_set("include_path", "new/path/here");

3. Move your package. Find it using search, copy it and paste it into usr/local/pear/share/pear

  • Upvote 1
Link to comment
Share on other sites

thanks for your help, but I can't find QuickForm2.php even though I have a Pear folder. MAMP/bin/php5.3.6/lib/php/PEAR/  I presume if I have the pear folder than that file should be there. As to hidden folders, I am on a mac, and am not aware of any hidden folders that I could access. Is it possible to just download the QuickForm2 package? thanks again. wallys12345

Link to comment
Share on other sites

Guest Deleted

Thanks. The file is not there. is it possible to just download this particular file, because it appears as if it is not on my computer? Nothing comes up in the finder.

 

I would like to know this too. I don't understand why you have to install HTML_QuickForm2 and include it when you use it in a PHP file. Shouldn't it be one or the other?

Link to comment
Share on other sites

If I recall correctly, HTML_QuickForm2 is a class from the pear framework so you need to download any feature you want to use. Then you have to require it in the scripts that use that class. I never completely understood how

require('HTML/QuickForm2.php');

made it possible for me to use it but I think its because php through php.ini has a list of directories it searches through for files/classes. By installing it you tell php where to find it. I think I followed the steps on the pear site. Sorry I can't be more definite, it was awhile ago.

Link to comment
Share on other sites

Guest Deleted

Would anybody happen to know how install it on a shared host? I have cpanel and I have ssh access. It's a linux server.

Link to comment
Share on other sites

Guest Deleted
My host said I can install pear packages from the command line. So I did this:

 

pear install HTML_QuickForm2-2.0.0

 

 

And then this happened:

 

downloading HTML_QuickForm2-2.0.0.tgz ...

Starting to download HTML_QuickForm2-2.0.0.tgz (178,224 bytes)

.....................................done: 178,224 bytes

downloading HTML_Common2-2.1.0.tgz ...

Starting to download HTML_Common2-2.1.0.tgz (8,630 bytes)

...done: 8,630 bytes

 

 

 

 

But if I try to do this in a script:

 

require('HTML/QuickForm2.php');

 

 

I get this:

 

Warning: require(HTML/QuickForm2.php): failed to open stream: No such file or directory in /home/mywebsitenamehere/public_html/js_test.php on line 6

 

Fatal error: require(): Failed opening required 'HTML/QuickForm2.php' (include_path='.:/usr/php/54/usr/lib64:/usr/php/54/usr/share/pear') in /home/mywebsitenamehere/public_html/js_test.php on line 6

 

 

What should I do?

Link to comment
Share on other sites

Guest Deleted

Oooh, I got it to work. I had to change the include_path in php.ini

 

I had to change it to something like this:

 

include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/myusernamegoeshere/php"

Link to comment
Share on other sites

  • 7 years later...

I'm not using XAMPP. Instead, I'm using LAMP components installed individually on Debian Buster (at least for home computer). The Apache error log showed me the problem - apparently, utilities.inc.php was trying to load components automatically related to HTML_QuickForm2, and that created the failure conditions of my system trying to "load" HTML_QuickForm2 component classes. In fact, since I was using Debian locally, I could tell my the Pear HTML_QuickForm2 stuff was located in /usr/share/php.  So, I commented out the class_loader() and spl_autoload_register lines in the utilities.inc.php and added require('classes/User.php') and require('classes/Post.php') manually when needed (and I did opt for the Post.php vice the Page.php class, but that's a trivial set of tweaks).  And then, basically, it worked!  So, the auto loading class feature was breaking HTML_QuickForm2.  

If anyone knows how to keep the autoloading class feature, let me know. But since this OOP code is so small, I figure it's a small price to pay to manually load a class or two as needed.

Link to comment
Share on other sites

  • 2 weeks later...
 Share

×
×
  • Create New...