PDA

Bekijk de volledige versie : more php extensions



shinji257
17-06-2008, 03:16
Who is interested in more php extensions? I am currently compiling more extensions for php to use on my router. This is how I am doing it...

Download the php 5.2.6 source

Navigate to <src>/ext/<extension>

phpize

./configure

make

make install


Note that configure may need additional modules

I currently have iconv and gmp already done. iconv is needed for some php scripts and uses the built in iconv implementation however you may need gconv-modules (it gets listed as "unknown") and gmp uses libgmp which is available in ipkg. I have not been able to verify that iconv actually works with the implementation that is present. If you can give me something that I can use to test it then let me know. I'll post both modules up when I get home. They were compiled directly on the router.

EDIT: Well no responses so far so I'll go ahead and attach the two extension that I have done so far. I wanted to do an updated eaccelerator extension but it gets stuck trying to use sysvipc. In 0.9.5.3 they made it so that you have to define a uid (other than zero) that eaccelerator will be running as. Kinda a pain and a brick road.

For each extension simply drop them into /opt/lib/php/extensions and then add the appropriate extension line to /opt/etc/php.ini. I'll do more if there is demand for it but in the meantime I'll do them as needed.

P.S. - gmp is a faster and better library than bcmath. Typically scripts as for either one and recommend gmp if available. The stock php setup include bcmath.

wpte
17-06-2008, 23:35
hey wow, that's good:D
more php extensions! yummy:)

question: did you use my how-to?:p

shinji257
18-06-2008, 00:45
Yes I did and I am open to suggestions as to which ones I should do next. ;)

Oh and you may need php-dev to compile php extensions although I doubt it. I have it installed anyways just in case. Looks like phpize and php-config is included in the main php stuff.

DrChair
18-06-2008, 20:57
It would be better to make .mk files for the extra php-extensions.

This way they can be added to the optware-feeds.

advantages:
-they become available to other devices
-if php gets updated, the extentions also get rebuild
-easer to install on your router

shinji257
18-06-2008, 23:04
Yes. I plan on doing that. ;) This is to satisfy those that want it now until I get a chance. It should work on any mips-based router though.

Beowulf
09-12-2008, 22:43
Hi,
I need an upload-progress-bar (for a html-post-form) for my websites running on the router. I am currently using
-lighttpd 1.4.20-1
-php - 5.2.6-2
-php-fcgi - 5.2.6-1
I have read on some pages that with the php APC extension (http://pecl.php.net/package/APC) it should work (c.f. here (http://martinjansen.com/2007/04/28/file-upload-progress-bars-with-php/))
I hope that someone of you can help me to get the extension working that I can use some sort of upload progress bar with lighttpd.

shinji257
09-12-2008, 23:12
Which router?

I just checked and it looks like I had 3.0.19 already built but never tested it I guess. apc.so is present in the .libs folder from the compile.

I have attached it to this message. Drop it in the same folder as where all the usual extensions go to.

Beowulf
10-12-2008, 00:27
thank you very much,
I can load the extension. But somehow the progress bars still don't work.
Can you try it out? php script is for example here (http://webreflection.blogspot.com/2007/10/upload-progress-bar-with-php5-apc-and.html) or here (http://abhinavsingh.googlecode.com/svn/trunk/PHP/FileUploadMeter/).

I think it is maybe the caching of lighttpd which gives the file to php not until it is already downloaded. Do you know any solution so that the upload progress can be displayed??

Beowulf
10-12-2008, 01:06
Which router?
It is the WL-500gP V2 with the newest oleg-fw.

in my php.ini I have the following section:

[APC]
extension=apc.so
apc.enabled=1
apc.shm_segments=1
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.max_file_size = 200M
apc.post_max_size = 200M
apc.upload_max_filesize = 200M
apc.enable_cli=1
apc.rfc1867=1

while I am uploading a file, I don't see a file named /tmp/apc.XXXXXX in my tmp folder on the router.

shinji257
10-12-2008, 01:09
Actually can I see your phpinfo information?

BTW, My php install seems to have issues of their own. It is seg faulting so I will need to fix that first. Probably just need to either update or reboot the router.

EDIT: Updated and rebooted and that took care of the seg fault. I switched the caching engine from eAccelerator to APC for now.

I found this while looking at the comments on the first link.


After my tests, it seems:

this progress bar cannot work with:
suhosin's patch.

and if php works as fastcgi - it cannot work too.

So if you are under (ubuntu 8.04) where php comes with suhosin already - you must rebuild witout suhosin.

I can help you with that. just email me at
huglester@gmail.com

good luck!


Please note that it doesn't use shared memory but rather mmap files on my compile. The ASUS routers would not have sufficient ram for a shm (shared memory) setup.

We use fastcgi in order to allow caching setups to work. I found apc to not work well but eaccelerator works quite well.

Beowulf
10-12-2008, 18:02
I have attached my phpinfo.

How can I use php without fastcgi? Or is it not worth a try?

Or is the only solution for an upload progress bar to use apache?
Do you know if apache runs stable and fast enough on the router?

I hope you can help me somehow to get it working.
many thank's

shinji257
10-12-2008, 19:22
The only way to use APC is either as fastcgi or with mod_php on Apache. I havn't personally tried Apache on the router so I do not know how well it would work.

Beowulf
10-12-2008, 22:12
Ok, so I can forget about lighttpd 1.4.
I have seen in another thread (http://wl500g.info/showthread.php?p=116413#post116413) that you managed to compile lighttpd 1.5.
And with that version there is probably a much easier solution (c.f. here (http://upload.lighttpd.net/index.html)) without PHP extensions.
Do you think that this prerelease is already usable?
And is it possible to compile it directly on the router (in this way (http://wl500g.info/showthread.php?t=14538&highlight=compile))?
I have found the mod_uploadprogress.so in your compiled package, so it should work, right?

shinji257
11-12-2008, 03:57
Yes. In fact my initial compile was done right on the router. With a cross-compile I could nearly duplicate all the options. The ipk file is attached to the message you linked to so you can use that to install it. It is able to re-use some stuff from the original one but stability was never tested. Just that it worked. I don't know if a new release was done since r2349.