php-general Digest 9 Sep 2007 05:40:05 -0000 Issue 5008

Topics (messages 261838 through 261863):

Re: Reg.Photo Upload Tool
        261838 by: Børge Holen

Image Conversion...
        261839 by: Tony Di Croce
        261844 by: cajb
        261853 by: Kevin Waterson

Re: LAMP Server setup help
        261840 by: Randy Patterson
        261841 by: Børge Holen
        261842 by: Børge Holen

Re: Image Conversion... OT!
        261843 by: Børge Holen
        261845 by: Vidyut Luther
        261846 by: Børge Holen
        261847 by: Vidyut Luther

Can't execute PHP script
        261848 by: Randy Patterson
        261849 by: Børge Holen
        261850 by: brian

Buxa Coding Guidelines
        261851 by: magoo
        261855 by: tedd
        261856 by: Kevin Waterson
        261860 by: Greg Donald
        261862 by: mike

Re: html2png
        261852 by: Kevin Waterson

pdo_mysql segfault error
        261854 by: Slith

Re: Converting PHP code to C#?
        261857 by: Symbian
        261861 by: mike
        261863 by: Symbian

Pack function in C#
        261858 by: Symbian

zlib.inflate vs. gzopen/fread
        261859 by: Gregory Beaver

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Friday 07 September 2007 12:07, Ramesh.b wrote:
> Thanks Jay,
>
> I want a client side tool , something similar to Yahoo photos or flickr,
> where it will shrink the size of the image and upload.

You'd be better of makin' one yerself. Last time I got some questions about 
fileuploads and checked out yahoo for a friend, maby I don't remember 
correctly but didn't I actually see flash as a frontend.
Who would want such a thing. None've us with a ppc-arch anyhow

>
> Thanks
> Ramesh
> ""Jay Blanchard"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> [snip]
> Any opensource or PHP applicaiton is available for Photo upload tool?.
> [/snip]
>
> Easy to do yourself....
> http://us2.php.net/manual/en/features.file-upload.php

--- End Message ---
--- Begin Message ---
I need to convert (resize, and store as blob's in a mysql db) images my
users can upload. I'm wondering what the best conversion tool is... I'm
considering ImageMagick... Is this the best?

Is their anything that is integrated with PHP itself?

  td

--- End Message ---
--- Begin Message ---
On 9/8/07, Tony Di Croce <[EMAIL PROTECTED]> wrote:
> I need to convert (resize, and store as blob's in a mysql db) images

avoid that for no further problems.

> ImageMagick

you can use this tool for your needs.


-- 
Romanul s-a nascut poet. Trebuia sa se nasca neamt!

--- End Message ---
--- Begin Message ---
This one time, at band camp, "Tony Di Croce" <[EMAIL PROTECTED]> wrote:

> I need to convert (resize, and store as blob's in a mysql db) images my
> users can upload. I'm wondering what the best conversion tool is... I'm
> considering ImageMagick... Is this the best?
> 
> Is their anything that is integrated with PHP itself?
> 
>   td
> 

http://phpro.org/tutorials/Storing-Images-in-MySQL-with-PHP.html


-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

--- End Message ---
--- Begin Message ---
On Saturday 08 September 2007 12:20, Børge Holen wrote:
> On Saturday 08 September 2007 10:07, Randy Patterson wrote:
> > Hey,
> >
> > I have setup a test system on my home network in the past to develop &
> > test PHP apps by installing an ISAPI PHP dll in IIS. It worked great but
> > now I trying to setup a LAMP server on Debian/Lenny. I ran the following
> > command;
> >
> > aptitude install apache2 php5 libapache2-mod-php5
> >
> > But got the following error message;
> >
> > Setting up apache2-mpm-prefork (2.2.4-3) ...
> > Starting web server: apache2apache2: Syntax error on line 187
> > of /etc/apache2/apache2.conf: Syntax error on line 3
> > of /etc/apache2/httpd.conf: Cannot load /etc/apache2/modules/libphp5.so
> > into server: /etc/apache2/modules/libphp5.so: cannot open shared object
> > file: No such file or directory
> >  failed!
> > invoke-rc.d: initscript apache2, action "start" failed.
> >
> > The error is pointing to this line in the httpd.conf;
> >
> > LoadModule php5_module      modules/libphp5.so
> >
> > But this directory or file don't exist in the /etc/apache2 directory.
> >
> > Not sure how to fix this. I'm a newbie when it comes to the LAMP server
> > apps. Any help would be appreciated.
>
> Seems very much like some missinformation of some kind.
> Apache2 should not use any modules/  directory.
>
> Apache2 uses symlinks to enable modules, check if symlink exists.
> In the directory mods-enabled there should reside syms like this:
> php5.conf -> ../mods-available/php5.conf
> php5.load -> ../mods-available/php5.load
>
> Any other php relations within both httpd and apache2 conf is to be
> removed. It does not complain over missing php libs, it complains about
> syntax error.

 I think you have put your finger on the problem, those links are not there. I 
read this article on the subject;

http://www.debian-administration.org/articles/207

Which referred to these programs; a2ensite, a2dissite, a2enmod and a2dismod.

Although I have apache2 installed, these programs are not present. Are they 
part of another package? Not sure that I would get the links correct if I did 
it manually.

Thanks

--- End Message ---
--- Begin Message ---
On Saturday 08 September 2007 12:54, Randy Patterson wrote:
> On Saturday 08 September 2007 12:20, Børge Holen wrote:
> > On Saturday 08 September 2007 10:07, Randy Patterson wrote:
> > > Hey,
> > >
> > > I have setup a test system on my home network in the past to develop &
> > > test PHP apps by installing an ISAPI PHP dll in IIS. It worked great
> > > but now I trying to setup a LAMP server on Debian/Lenny. I ran the
> > > following command;
> > >
> > > aptitude install apache2 php5 libapache2-mod-php5
> > >
> > > But got the following error message;
> > >
> > > Setting up apache2-mpm-prefork (2.2.4-3) ...
> > > Starting web server: apache2apache2: Syntax error on line 187
> > > of /etc/apache2/apache2.conf: Syntax error on line 3
> > > of /etc/apache2/httpd.conf: Cannot load /etc/apache2/modules/libphp5.so
> > > into server: /etc/apache2/modules/libphp5.so: cannot open shared object
> > > file: No such file or directory
> > >  failed!
> > > invoke-rc.d: initscript apache2, action "start" failed.
> > >
> > > The error is pointing to this line in the httpd.conf;
> > >
> > > LoadModule php5_module    modules/libphp5.so
> > >
> > > But this directory or file don't exist in the /etc/apache2 directory.
> > >
> > > Not sure how to fix this. I'm a newbie when it comes to the LAMP server
> > > apps. Any help would be appreciated.
> >
> > Seems very much like some missinformation of some kind.
> > Apache2 should not use any modules/  directory.
> >
> > Apache2 uses symlinks to enable modules, check if symlink exists.
> > In the directory mods-enabled there should reside syms like this:
> > php5.conf -> ../mods-available/php5.conf
> > php5.load -> ../mods-available/php5.load
> >
> > Any other php relations within both httpd and apache2 conf is to be
> > removed. It does not complain over missing php libs, it complains about
> > syntax error.
>
>  I think you have put your finger on the problem, those links are not
> there. I read this article on the subject;
>
> http://www.debian-administration.org/articles/207
>
> Which referred to these programs; a2ensite, a2dissite, a2enmod and
> a2dismod.
>
> Although I have apache2 installed, these programs are not present. Are they
> part of another package? Not sure that I would get the links correct if I
> did it manually.
>
> Thanks

--- End Message ---
--- Begin Message ---
On Saturday 08 September 2007 12:54, Randy Patterson wrote:
> On Saturday 08 September 2007 12:20, Børge Holen wrote:
> > On Saturday 08 September 2007 10:07, Randy Patterson wrote:
> > > Hey,
> > >
> > > I have setup a test system on my home network in the past to develop &
> > > test PHP apps by installing an ISAPI PHP dll in IIS. It worked great
> > > but now I trying to setup a LAMP server on Debian/Lenny. I ran the
> > > following command;
> > >
> > > aptitude install apache2 php5 libapache2-mod-php5
> > >
> > > But got the following error message;
> > >
> > > Setting up apache2-mpm-prefork (2.2.4-3) ...
> > > Starting web server: apache2apache2: Syntax error on line 187
> > > of /etc/apache2/apache2.conf: Syntax error on line 3
> > > of /etc/apache2/httpd.conf: Cannot load /etc/apache2/modules/libphp5.so
> > > into server: /etc/apache2/modules/libphp5.so: cannot open shared object
> > > file: No such file or directory
> > >  failed!
> > > invoke-rc.d: initscript apache2, action "start" failed.
> > >
> > > The error is pointing to this line in the httpd.conf;
> > >
> > > LoadModule php5_module    modules/libphp5.so
> > >
> > > But this directory or file don't exist in the /etc/apache2 directory.
> > >
> > > Not sure how to fix this. I'm a newbie when it comes to the LAMP server
> > > apps. Any help would be appreciated.
> >
> > Seems very much like some missinformation of some kind.
> > Apache2 should not use any modules/  directory.
> >
> > Apache2 uses symlinks to enable modules, check if symlink exists.
> > In the directory mods-enabled there should reside syms like this:
> > php5.conf -> ../mods-available/php5.conf
> > php5.load -> ../mods-available/php5.load
> >
> > Any other php relations within both httpd and apache2 conf is to be
> > removed. It does not complain over missing php libs, it complains about
> > syntax error.
>
>  I think you have put your finger on the problem, those links are not
> there. I read this article on the subject;
>
> http://www.debian-administration.org/articles/207
>
> Which referred to these programs; a2ensite, a2dissite, a2enmod and
> a2dismod.
>
> Although I have apache2 installed, these programs are not present. Are they
> part of another package? Not sure that I would get the links correct if I
> did it manually.

is the files php5.conf and load inside the mods-available package?
Come to think of it, it sounds like a mixup of apache2 and 
libapache-php-mod... nah whatever.

if the files are there, its easy. 
Enter the dir
ln -s php5.conf ../mods-enabled/
ln -s php5.conf ../mods-enabled/

if not, print back the results for:
dpkg -l|grep apache
dpkg -l|grep php

>
> Thanks

--- End Message ---
--- Begin Message ---
On Saturday 08 September 2007 12:48, Tony Di Croce wrote:
> I need to convert (resize, and store as blob's in a mysql db) 
oh oh oh... NO we can slap the horse again ;D

> images my 
> users can upload. I'm wondering what the best conversion tool is... I'm
> considering ImageMagick... Is this the best?

consider using something you know for starters, then expand?
as for the question itself, yes is it the best?
anyone?

>
> Is their anything that is integrated with PHP itself?
>
>   td

--- End Message ---
--- Begin Message ---
Børge Holen wrote:
> On Saturday 08 September 2007 12:48, Tony Di Croce wrote:
>   
>> I need to convert (resize, and store as blob's in a mysql db) 
>>     
> oh oh oh... NO we can slap the horse again ;D
>
>   
>> images my 
>> users can upload. I'm wondering what the best conversion tool is... I'm
>> considering ImageMagick... Is this the best?
>>     
>
> consider using something you know for starters, then expand?
> as for the question itself, yes is it the best?
> anyone?
>
>   

Best is subjective, does it work the best? IMO yes, it's the best tool,
but keep in mind, this makes your script less portable, not all hosts
will allow you to run the 'convert' binary, nor will all installations
have it readily available (Windows doesn't come with ImageMagick by
default). It works the best for the applications I've written so far,
but the PHP gd functions are just as powerful and probably more
portable.. so without knowing all your requirements, it's hard to give a
definitive answer :).




>> Is their anything that is integrated with PHP itself?
>>
>>   td
>>     
>
>   

--- End Message ---
--- Begin Message ---
On Saturday 08 September 2007 13:59, Vidyut Luther wrote:
> Børge Holen wrote:
> > On Saturday 08 September 2007 12:48, Tony Di Croce wrote:
> >> I need to convert (resize, and store as blob's in a mysql db)
> >
> > oh oh oh... NO we can slap the horse again ;D
> >
> >> images my
> >> users can upload. I'm wondering what the best conversion tool is... I'm
> >> considering ImageMagick... Is this the best?
> >
> > consider using something you know for starters, then expand?
> > as for the question itself, yes is it the best?
> > anyone?
>
> Best is subjective, does it work the best? IMO yes, it's the best tool,
> but keep in mind, this makes your script less portable, not all hosts
> will allow you to run the 'convert' binary, nor will all installations
> have it readily available (Windows doesn't come with ImageMagick by
> default). It works the best for the applications I've written so far,
> but the PHP gd functions are just as powerful and probably more
> portable.. so without knowing all your requirements, it's hard to give a
> definitive answer :).

as I run my own host... I solely asking for  the quality. 
pnmscale and cjpeg is the tools currently in use.

>
> >> Is their anything that is integrated with PHP itself?
> >>
> >>   td

--- End Message ---
--- Begin Message ---
I've been using ImageMagick pretty much since 1997, I'm probably biased
or ignorant of other tools that are probably available to people these
days :). But, ImageMagick still works wonderfully for me, so.. yes it's
the best :).

Børge Holen wrote:
> On Saturday 08 September 2007 13:59, Vidyut Luther wrote:
>   
>> Børge Holen wrote:
>>     
>>> On Saturday 08 September 2007 12:48, Tony Di Croce wrote:
>>>       
>>>> I need to convert (resize, and store as blob's in a mysql db)
>>>>         
>>> oh oh oh... NO we can slap the horse again ;D
>>>
>>>       
>>>> images my
>>>> users can upload. I'm wondering what the best conversion tool is... I'm
>>>> considering ImageMagick... Is this the best?
>>>>         
>>> consider using something you know for starters, then expand?
>>> as for the question itself, yes is it the best?
>>> anyone?
>>>       
>> Best is subjective, does it work the best? IMO yes, it's the best tool,
>> but keep in mind, this makes your script less portable, not all hosts
>> will allow you to run the 'convert' binary, nor will all installations
>> have it readily available (Windows doesn't come with ImageMagick by
>> default). It works the best for the applications I've written so far,
>> but the PHP gd functions are just as powerful and probably more
>> portable.. so without knowing all your requirements, it's hard to give a
>> definitive answer :).
>>     
>
> as I run my own host... I solely asking for  the quality. 
> pnmscale and cjpeg is the tools currently in use.
>
>   
>>>> Is their anything that is integrated with PHP itself?
>>>>
>>>>   td
>>>>         
>
>   

--- End Message ---
--- Begin Message ---
Hey,

[Note:] This is a different problem from the one I posted earlier today. 

I can't get my LAMP server setup to run PHP script.

As returned by apache2ctl, I am running;

Apache/2.2.4 (Debian) PHP/5.2.3-1+b1

I point my browser to;

http://localhost/apache2-default/test.php

The file test.php contains this code;

<html><body>
<h1>PHP Test</h1>
<br />
<?php print "Hello World!"; ?>
</body></html>

The browser outputs only;

PHP Test

But the script doesn't get executed. I posted this problem on debian-users, 
[because I installed apache2/php5 via debian packages], without any results. 
Thought I would try here before finding an apache list. Although I have 
programed in PHP off and on for a while I am a newbie to the setup side of 
things. Hopefully someone could point me in the right direction to trouble 
shoot this. 

Thanks,
Randy

--- End Message ---
--- Begin Message ---
as previously stated...

give us the printout of:
dpkg -l|grep apache
dpkg -l|grep php



On Saturday 08 September 2007 14:55, Randy Patterson wrote:
> Hey,
>
> [Note:] This is a different problem from the one I posted earlier today.
>
> I can't get my LAMP server setup to run PHP script.
>
> As returned by apache2ctl, I am running;
>
> Apache/2.2.4 (Debian) PHP/5.2.3-1+b1
>
> I point my browser to;
>
> http://localhost/apache2-default/test.php
>
> The file test.php contains this code;
>
> <html><body>
> <h1>PHP Test</h1>
> <br />
> <?php print "Hello World!"; ?>
> </body></html>
>
> The browser outputs only;
>
> PHP Test
>
> But the script doesn't get executed. I posted this problem on debian-users,
> [because I installed apache2/php5 via debian packages], without any
> results. Thought I would try here before finding an apache list. Although I
> have programed in PHP off and on for a while I am a newbie to the setup
> side of things. Hopefully someone could point me in the right direction to
> trouble shoot this.
>
> Thanks,
> Randy

--- End Message ---
--- Begin Message ---
Randy Patterson wrote:
Hey,

[Note:] This is a different problem from the one I posted earlier today.
I can't get my LAMP server setup to run PHP script.

As returned by apache2ctl, I am running;

Apache/2.2.4 (Debian) PHP/5.2.3-1+b1

I point my browser to;

http://localhost/apache2-default/test.php

The file test.php contains this code;

<html><body>
<h1>PHP Test</h1>
<br />
<?php print "Hello World!"; ?>
</body></html>

The browser outputs only;

PHP Test


Check in your httpd.conf that you have all of the following:

LoadModule php5_module  modules/libphp5.so
AddHandler php5-script  php
AddType text/html       php

Make sure they're in there and uncommented. And that you restart httpd.

brian

--- End Message ---
--- Begin Message ---
Hi NG!

Just wanted to see what you think of the strictness of Buxa, according to their PHP guidelines:
http://www.buxaprojects.com/en/php_coding_guidelines.htm

In their oppinion stuff like the short PHP init "<?" or inline echo "<?= $var ?>" is forbidden.
Do you people code that strict?

--
Kind regards,
magoo
--- End Message ---
--- Begin Message ---
At 12:17 AM +0200 9/9/07, magoo wrote:
Hi NG!

Just wanted to see what you think of the strictness of Buxa, according to their PHP guidelines:
http://www.buxaprojects.com/en/php_coding_guidelines.htm

In their oppinion stuff like the short PHP init "<?" or inline echo "<?= $var ?>" is forbidden.
Do you people code that strict?

I do.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
This one time, at band camp, tedd <[EMAIL PROTECTED]> wrote:

> At 12:17 AM +0200 9/9/07, magoo wrote:
> >Hi NG!
> >
> >Just wanted to see what you think of the strictness of Buxa, 
> >according to their PHP guidelines:
> >http://www.buxaprojects.com/en/php_coding_guidelines.htm
> >
> >In their oppinion stuff like the short PHP init "<?" or inline echo 
> >"<?= $var ?>" is forbidden.
> >Do you people code that strict?
> 
> I do.

me too, that sort of code is an abomination.
Short tags are not portable and should never have been introduced and
should not remain in php6

enjoy
Kevin

-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

--- End Message ---
--- Begin Message ---
On Sun, 9 Sep 2007, magoo wrote:
> Just wanted to see what you think of the strictness of Buxa, according to
> their PHP guidelines:
> http://www.buxaprojects.com/en/php_coding_guidelines.htm
>
> In their oppinion stuff like the short PHP init "<?" or inline echo "<?= $var
> ?>" is forbidden.
> Do you people code that strict?

I don't put PHP in my HTML.  I use PHP to build my HTML, using heredoc
syntax while doing so.  My scripts usually only have a single <?php
opening tag and never require any closing ?> tags.

Code that contains short open tags or instances of <?= is amatuer in my
opinion.


-- 
Greg Donald
Cyberfusion Consulting
http://cyberfusionconsulting.com/

--- End Message ---
--- Begin Message ---
On 9/8/07, Greg Donald <[EMAIL PROTECTED]> wrote:

> I don't put PHP in my HTML.  I use PHP to build my HTML, using heredoc
> syntax while doing so.  My scripts usually only have a single <?php
> opening tag and never require any closing ?> tags.
>
> Code that contains short open tags or instances of <?= is amatuer in my
> opinion.

agreed. i use echo so i can indent my code. inline php/html mix bugs me.

although handing off to a templating engine/presentation layer would
be even better of course.

--- End Message ---
--- Begin Message ---
This one time, at band camp, Al <[EMAIL PROTECTED]> wrote:
The Imagick php extension is at RC2 and like all beta ware,
should not be considered for a production environment.


> Imagick PHP extension, easiest, or Imagemagick command line using exec().
> 
> Imagick to read a pdf and output it as a jpeg:
> 
> header('Content-type: image/jpeg');
> $obj = new Imagick('xxxxx.pdf');
> $obj->SetImageFormat('jpeg');
> echo $obj;
> 
> Your want to use montage, resizing and write the result to a file, etc.



-- 
"Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote."

--- End Message ---
--- Begin Message --- i'm trying to enable pdo_mysql extension, however i keep getting the following segfault error when i restart apache:

httpd[20567]: segfault at 00000020abef8f07 rip 00000020abef8f07 rsp 00000000006e6ad0 error 14

my setup is the following:

Apache 1.3.37
php 5.2.2
mysql 5.0.41

not sure wether this problem is cause by my newer mysql version or 64bit server. has any gotten PDO_MYSQL on 64bit server?
--- End Message ---
--- Begin Message ---


mike-22 wrote:
> 
> just hard code the IV in both places.
> 

Thanks for the link, that was most useful, especially the commented bits!

RE: The IV, reading the php manual it states that the IV is not used when
ECB mode is used (which is what we are using). So knowing this does the use
of IV matter? I stripped the decrypt routine from the PHP file (big file!)
and tried it on a seperate PHP page without parsing a IV like so:

mcrypt_decrypt(MCRYPT_RIJNDAEL_128,$key,$mcryptData,MCRYPT_MODE_ECB,""); 

While i got an error from the module:

Warning:  mcrypt_decrypt() [function.mcrypt-decrypt]: The IV parameter must
be as long as the blocksize in crypto.php on line 38

It still decrypted it fine on the php page.
-- 
View this message in context: 
http://www.nabble.com/Converting-PHP-code-to-C---tf4397727.html#a12575594
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
i'm pretty sure the IV mattered in our stuff.

and remember i used CBC i think not EBC, and it worked fine. not sure
if you want to try that and make it work for you or not without any
warnings :)

On 9/8/07, Symbian <[EMAIL PROTECTED]> wrote:
>
>
>
> mike-22 wrote:
> >
> > just hard code the IV in both places.
> >
>
> Thanks for the link, that was most useful, especially the commented bits!
>
> RE: The IV, reading the php manual it states that the IV is not used when
> ECB mode is used (which is what we are using). So knowing this does the use
> of IV matter? I stripped the decrypt routine from the PHP file (big file!)
> and tried it on a seperate PHP page without parsing a IV like so:
>
> mcrypt_decrypt(MCRYPT_RIJNDAEL_128,$key,$mcryptData,MCRYPT_MODE_ECB,"");
>
> While i got an error from the module:
>
> Warning:  mcrypt_decrypt() [function.mcrypt-decrypt]: The IV parameter must
> be as long as the blocksize in crypto.php on line 38
>
> It still decrypted it fine on the php page.
> --
> View this message in context: 
> http://www.nabble.com/Converting-PHP-code-to-C---tf4397727.html#a12575594
> Sent from the PHP - General mailing list archive at Nabble.com.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---


mike-22 wrote:
> 
> i'm pretty sure the IV mattered in our stuff.
> 
> and remember i used CBC i think not EBC, and it worked fine. not sure
> if you want to try that and make it work for you or not without any
> warnings :)
> 

Ah! We're using EBC, also I realised that I needed to implement the
eqivalent of the pack function in PHP which we use, so I finally have the
correct (MD5'd both the PHP and C# bits) string going *into* the function. 

Now I have to wrestle with the Rijndael class again:(

            Rijndael r = Rijndael.Create();
            r.Mode = CipherMode.ECB;
            r.Padding = PaddingMode.None;
            r.Key = Encoding.ASCII.GetBytes(KEY);
            ICryptoTransform de = r.CreateDecryptor();
            byte[] output = CryptoTransform(input, de);

Sym
-- 
View this message in context: 
http://www.nabble.com/Converting-PHP-code-to-C---tf4397727.html#a12576182
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
hello,

Our PHP dev (who has since left) uses the pack function to turn a base64
string into a binary blob (?):

$blob = pack("H*", $postBase64Data);

Does anyone know what the above is doing? I need to translate that to C#
terms, which I thought was getting the eqivalent of the bytes:

byte[] blob = ASCIIEncoding.UTF8.GetBytes(postedData);

But this may not be right.

Sym
-- 
View this message in context: 
http://www.nabble.com/Pack-function-in-C--tf4407990.html#a12575709
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
Hi all,

I've run into a peculiar situation where the inflate implementation in
the zlib.inflate filter fails to successfully inflate a gzipped file
created using gzopen/gzwrite.  The file is really quite simple.  To
replicate, download http://pear.php.net/get/PEAR-1.6.1.tgz and run this
script:

<?php
$fp = fopen('PEAR-1.6.1.tgz', 'rb');
stream_filter_append($fp, 'zlib.inflate');
var_dump(fread($fp, 2000), feof($fp));
fclose($fp);
?>

output is:

string(0) ""
bool(false)

The results are the same when using file_get_contents(), readfile(), and
also with the zlib.inflate example in the PHP manual.  This is on a
64-bit system with PHP 5.2.4 CVS HEAD, although the zlib.inflate
implementation hasn't changed substantially since 2005 (and yes, I also
tested it without the 3-line patch introduced in PHP 5.2.1 to see if it
was the cause).

Can anyone else confirm the above behavior?

Thanks,
Greg

--- End Message ---

Reply via email to