Sometimes the plethora of scripting languages out there makes for a tough day... I have in the past, 'discovered' scripts to simulate HTTP form post/file upload from Java and Perl (the 2 languages I used most often in web scripts).
Today we're doing it (simulating file upload through HTTP form) from PHP. Simple enough?
require_once "HTTP/Request.php";
$req =& new HTTP_Request("http://myserver/myservlet");
$req->setMethod(HTTP_REQUEST_METHOD_POST);
$result = $req->addFile("myfile", "/myfile-full-location");
This gives error:
Failed opening required 'HTTP/Request.php' (include_path='.:/php/includes')
And for the next 2 hours, this little 'script' thing made me go through:
1. Install / re-configure PEAR
For PHP v5.0.3, PEAR comes preconfigured. But for some reason, I could not find 'Request.php' anywhere in the system using find.
Try this: upgrade a few installed packages; HTTP, Net_URL, Net_Socket and finally HTTP_Request. Also add the new path /usr/local/lib/php to the variable include_path in my php.ini file.
Your PHP does not support zlib?
2. Re-installation of PHP
This time, remember to configure it with these support flags: --with-zlib and --with-libxml (another roadblock: the version of libxml2 I had was too old).
Oops! Forgot the old configure flags --with-mysql and --with-apxs2.
Repeat this and repeat Step 1.
3. Still not working?
The message on the error page still hasn't changed! Wait a minute... I've recompiled & reinstalled PHP several times and nothing changes?
Try this: $ sudo apachectl graceful
Finally the problem is nailed... thank God!
I'm writing this note to myself just in case I need to open the car hood again :|
<rant>Everybody seems to run into this simulation process sometime. Why don't we make something new to spare the newer programmers and write a language-agnostic library or something?</rant>
No comments:
Post a Comment