AbelCam Forum
Download AbelCam buy Pro
 
 
 
Welcome Anonymous User
05/07/2024 - 03:23 AM
Quick Search:
Quick Jump:
 
Announcements
Latest Topics
 
Cannot get GD2 on PHP to work on AbelCam web server
By: RaleighMu
Rank: Frequent User
Topics: 24
From: USA
Added: 07/31/2010 - 02:23 PM

This is not a critical issue.

I have installed version 5.3.3 of PHP5 as directed in the documentation (unzipped into directory c:/php and used the suggested AbelCam template for php.ini). PHP appears to be running fine with AbelCam 3.2.3. However, I've installed a third party PHP script which does a hyperlinked directory listing (no index.html file required) in order to dynamically display all of my motion captured jpegs which I put in a separate directory. That script is basically working fine and can be found here:

http://www.evoluted.net/community/code/directorylisting.php

The only problem I have is that the script says that automatic thumbnail generation requires gd2 and I can't seem to get that to work on my rig. I can click on each file and it opens nicely, but the demo of the script shows that a mouseover will display a pop-up thumbnail which would be very nice for me.

AbelCam documentation does say that PHP is only partially supported, so this is NOT a complaint. However, I have been knocking myself out by modifying my php.ini file (the AbelCam version) and will stop my efforts if external modules, or just gd2, just aren't supported.

Here is what I've done to the php.ini file (these two line were originally made invisible as comments):

extension_dir="c:\php\ext\"
extension=php_gd2.dll

I've actually tried every possible value of extension_dir to no avail. What SHOULD happen is that php should find php_gd2.dll in the extension_dir directory and all will be well.

When I run phpinfo.php there are no modules listed and the following line is a mystery to me:

extension_dir => C:\php5 => C:\php5

Any thoughts on this? Anyone else doing extensive php work with AbelCam? I'm actually VERY pleased that basic php is working and will help me solve a lot of other problems.

Is it worth just setting up Apache and use that on another port to serve up that directory?

St. Louis, Missouri, USA
By: MelvinG
Rank: Magna Cum Laude
Topics: 661
From: Los Angeles, USA
Added: 07/31/2010 - 03:42 PM

Get rid of the backslash at the very end of your extension_dir path:

extension_dir="c:\php\ext"

Also... at the risk of stating the obvious... you need to search php.ini for "extension_dir" to see if it's being set multiple times/places. I just did so and noticed that the AbelCam suggested php.ini has a line in there setting extension_dir = .\ which if present in your ini would probably explain why the php install dir is reported as being the extension dir.

BTW... is your install dir "c:\php\" or "c:\php5\"??? If your post is accurate there's a problem in your installation - you think PHP is in c:\php but PHP thinks it lives in c:\php5. Another thing to look for in the ini perhaps??

Oh yeah... GD2 works just fine for me with AbelCam + PHP. I now serve my site with Apache + PHP and use AbelCam only as a backend. But I used to serve my GD2-powered photo gallery thru AbelCam PHP, and I just tried it right now - no problem. I stopped using AbelCam + PHP for reasons unrelated to GD2 or other extensions. I think I got fed up with how the AbelCam webserver handles framesets (it's not really designed to handle them at all, but...) and went to Apache. Plus with Apache + PHP + mod_proxy I put another layer of firewalling between my cams and the world.
By: RaleighMu
Rank: Frequent User
Topics: 24
From: USA
Added: 07/31/2010 - 06:45 PM

Thanks, Mr. MelvinG. You've given me a few more things to work on. I originally found the extension_dir=.\ line in php.ini which is what I modified to point to where things actually resided in the first place, and I still suspect that's my problem. Getting rid of the trailing slash didn't change anything, but for troubleshooting purposes I should be systematic and try both types of slashes (and restart the AbelCam web server, AND restart my operating system). I'm used to creating comprehensive Linux server boxes where all the paths normally are congruent. I'll continue to do some basic trouble shooting and give some feedback herein so others can benefit from the experience.

FYI, I didn't do a php install (in the Linux sense) but just unpacked the zipped directory to c:/php as noted in the extant AbelCam documentation. I think I saw something about "paths" in the xml config files for AbelCam to point to a different directory other than the expected c:/php one.

If you could (no malice if you can't), a check would be to install (copy) the actual php script linked to in my original message (it's configured to invoke gd2 by default) in some random test directory with a jpg or two and see if a mouse roll-over invokes gd2. If not, that would tell me that the issues are elsewhere. If it does work, I'll keep being stubborn and get it working. Again, if not, I'm not miffed (but it would probably take less than 5 minutes - it's that simple).

Yeah, I figured GD2 would work fine (heck, it's just an executable .dll being called up to be executed in the Windows php environment (with which I don't have a lot of experience) and shouldn't depend upon the AbelCam web server in any way). I'll be a bit more stubborn.

Off topic. You the Nixie Tube guy?

Just an ex-Angeleno (go Bruins!).
By: MelvinG
Rank: Magna Cum Laude
Topics: 661
From: Los Angeles, USA
Added: 08/01/2010 - 09:25 AM

Quick one - just got here...

I did as you asked - installed the script, etc. Yes, it is failing to produce thumbs for me too when serving with AbelCam. But it works fine served with Apache. The AbelCam I'm testing with is on the same WinXP box as Apache, uses the same installation of PHP, same php.ini and so forth.

I have a few ideas - will get back to you in a little while once I try some things.

Thinking back and looking at what's saved on my "distros" drive, I must've done an install (in the Win32 sense) of PHP since my saved distro is an MSI file. "php-5.2.9-2-win32-installer.msi" which probably isn't the recommended version for AbelCam but seems to work Cool!

Yeah, I'm the Nixie Tube Guy... and thanks for that "Go Bruins". If you'd said "Trojans" instead I'd have had to quit helping you - LOL. You can use the contact email on my site anytime you want to talk O/T - I do check that email account.
By: MelvinG
Rank: Magna Cum Laude
Topics: 661
From: Los Angeles, USA
Added: 08/01/2010 - 11:53 AM

Okay... here's my take on what's going on...

Every time you mouse over a line in the directory listing, /dlf/i.php is called with ?f=filename, which creates the thumb on the fly.

1) In i.php the filename is gotten out of the URL by using $_REQUEST['f'] (perfectly legit method). But AbelCam is not loading up $_REQUEST with the parameter(s) like I'd expect it to. I remember having this problem ages ago and working around it by changing all $_REQUEST to $_GET, but that no longer works. The only place I could find the "?" parameters was in $_SERVER['argv']. They are there but it ain't pretty... the "?" and all that follows are lumped together in argv[1]. Meh.

2) I modified the scripts so that the thumb maker would get its filenames from argv[1]. That fixes it to a degree - at least it makes a thumbnail image, BUT AbelCam is stripping off the "Content-Type: image/jpeg" header that i.php provided and replacing it with "text/html". Huh? So the thumbnails still don't display because an image is expected and the header claims we got back text. Meh^2.

3) The issue in (1) with parameters also breaks the various param-driven features that index.php offers (sort order, etc.) that can optionally be specified in the URL. This can't be hacked up with 'argv' as readily as the passing of a single parameter to i.php was.

I'm SURE the AbelCam + PHP used to work better than this. In fact, I have some old code here from my old-old-old website (that was 100% served by older AbelCam + PHP) that I know used to work but will not work given the current state of affairs. What I don't have is a really old version of AbelCam to play with.

To move on from here we need Mr. SSE to look into what might have gotten broken in AbelCam. I know PHP support hasn't been looked at nor tested since many releases ago because when I switched over to Apache that took us from 1 to zero active users using Abel + PHP "seriously". I'll drop a post on the Issue Tracker to bring this to his attention, but I'm not sure how enthused he's gonna be about troubleshooting such an unpopular feature.

EDIT to ADD: Here's your script running under Apache...

http://eeber.no-ip.org:9334/test

By: RaleighMu
Rank: Frequent User
Topics: 24
From: USA
Added: 08/01/2010 - 03:49 PM

Thanks for the update. You've saved me a lot of time and I'm convinced that if I want to pursue some heavy duty PHP development I'm better served with an Apache-PHP approach. Also, though I've developed a number of LAMP applications (Linux Apache MySQL PHP) I wouldn't call myself an expert (though I understood everything in you previous message).

I wonder of PHP isn't that popular due to the fact that AbelCam is marketed as an easy, turnkey solution (it is) and the people who tend to use such applications are less likely to monkey around with code. That being said, that's one of the things I like about AbelCam is that you can monkey around with it a lot.

Also, maybe PHP isn't that popular because it doesn't work that well!

Thanks again!
By: MelvinG
Rank: Magna Cum Laude
Topics: 661
From: Los Angeles, USA
Added: 08/01/2010 - 06:30 PM

When PHP was first added to AbelCam it worked pretty well, and after Mr. SSE and I went thru a few iterations of test / modify / re-release over on the Issue Tracker it worked really well. The "limited support" disclaimer was almost meaningless at that time. Something has been broken as AbelCam moved forward and you and I are just now discovering it.

The only reason I abandoned Abel + PHP was that at the time I had it stuck in my head that I wanted to use a frameset on my site (bad idea) and AbelCam server didn't want to cooperate. Wasn't even a PHP problem...

*** Pure speculation follows ***

I think it's safe to say that the reason PHP didn't catch on with AbelCam users is NOT because of limitations or bugs. I think your first idea is the right one: the majority of users want quick & easy, and if it takes more than 3 mouse clicks to set it up then it's too much trouble. Heck, most users use the web pages that come with AbelCam - unmodified - even though those pages were intended to be example / starting point stuff, not finished work.

Then there are a handful of users at the other end of the scale. You tend to see these people participating on the Issue Tracker and having their sites listed on the Camera List page. People like myself, who may not be expert developers but don't mind throwing together a bit of PHP or some C++ or Perl or whatever to create what they want. Thing is, these kinda users (I suspect) tend to already have a box or two set up for LAMP (or WAMP as the case may be) and go with what they know works rather than delving into Abel + PHP. Putting the site on the Apache box and plunking a few Java applets into the pages - to interact with an AbelCam "back end", maybe on a different box altogether - is pretty darn easy IMO and has certain advantages...
By: RaleighMu
Rank: Frequent User
Topics: 24
From: USA
Added: 08/01/2010 - 06:46 PM

Just for the record (and in case anyone else is paying attention and can benefit from following this thread), my final solution was to, indeed, install Apache on the same box running my AbelCam. The AbelCam web server is working nicely as it always did, and Apache and PHP are playing well together (as they should).

I am now successfully using the nifty little directory lister I got from:

http://www.evoluted.net/community/code/directorylisting.php

So what I do is local save on motion to a directory served up by Apache. When I access the page the php directorylisting script, renamed to be index.php, lists all files to date, and by running my mouse over a file name I get an "on the fly" thumbnail. Real quick way to browse captured images and I only have to open those that the thumbnail indicates may be of interest.

I'm going to dabble in creating an hourly scheduled job to create a directory tree that will be divided up by year, month, day, and hour. It'll make a nice auto archive system of all motion captured images over time. Cool!

St. Louis, Missouri, USA
By: sse
Rank: Forum Addict
Topics: 73
From: n/a
Added: 08/02/2010 - 07:49 PM

Melvin, I agree with your speculations.

Limitations are due to the PHP interface used (command line), please see Issue 344
By: RaleighMu
Rank: Frequent User
Topics: 24
From: USA
Added: 08/02/2010 - 10:12 PM

So, by implication if I install the older version of PHP mentioned on the wiki (version 5.2.9) I should have less issues than when I use the latest version (5.3.3)? I can't test this until I get home from work (it is 1505 in St. Louis, Missouri, USA) but intend to do so for further enlightenment. No pain, no gain.

One of the reasons it is useful to know this is so that at least the wiki entry http://www.abelcam.com/en/abelwiki/HowToUsePHP could be updated to more accurately reflect that using newer versions than 5.2.9 could cause problems with newer scripts.

St. Louis, Missouri, USA
By: MelvinG
Rank: Magna Cum Laude
Topics: 661
From: Los Angeles, USA
Added: 08/03/2010 - 12:21 AM

I'm still scratching my head about the matter of $_GET. I understand and agree that $_REQUEST couldn't have ever worked - PHP docs are clear about this. The docs are less clear about $_GET when using command line style invocation. Logic would seem to dictate that something invoked from the command line wouldn't have any knowledge of something that's pretty specific to the webserver, but the docs don't come right out and say so for $_GET like they do for $_REQUEST.

And yet... I have this old code here that I wrote when I was trying to be a "100% served by AbelCam" site. This code worked - it ran my site for a few months and the only problems were frameset related. This code uses $_GET all over the place. If the $_GET wasn't working the site eould never have worked. I have no recollection of ever having to use ARGV and split the pairs as a workaround for $_GET and (more reliable than my memory) there is no trace of any commented-out ARGV-processing code in any of the PHP files.

Also... I checked, and my PHP is the recommended version. It's different only in that is was distributed as an MSI rather than as a ZIP.