php-general Digest 22 Mar 2012 05:56:41 -0000 Issue 7738

Topics (messages 317160 through 317171):

Re: php upload does not work proper, ["tmp_name"] and other are missing in 
$_FILES
        317160 by: Meike Stone
        317162 by: Matijn Woudt

PEAR_Error reporting
        317161 by: Karl-Arne Gjersøyen

Thinking out loud - a continuation...
        317163 by: Jay Blanchard
        317164 by: Adam Richardson
        317165 by: Daniel Brown
        317166 by: Jay Blanchard
        317167 by: Robert Cummings
        317168 by: Jay Blanchard
        317169 by: Jim Lucas
        317171 by: Robert Cummings

Node.PHP
        317170 by: Joseph Moniz

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
>
> But what is the reason, that the module not work properly?
> Which next step can I do?

I figured out, that the new mod_php5.so is not linked against
libmm.so.14. Can this be the problem?

Thanks Meike

# ldd mod_php5.so.5.3.8
        linux-vdso.so.1 =>  (0x00007fffe051c000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f3d30f82000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f3d30d6b000)
        libpcre.so.0 => /usr/lib64/libpcre.so.0 (0x00007f3d30b3a000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f3d30931000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f3d306b8000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f3d304b3000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f3d3029b000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f3d30085000)
        libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007f3d2fd28000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f3d2f9b4000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f3d2f797000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f3d31c0f000)

# ldd mod_php5.so.5.2.14
        linux-vdso.so.1 =>  (0x00007fffcdfff000)
        libmm.so.14 => /usr/lib64/libmm.so.14 (0x00007f0307223000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f0307428000)      
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f0306bd2000)    
        libpcre.so.0 => /usr/lib64/libpcre.so.0 (0x00007f0306ff2000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f0306de9000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f0306958000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f0306754000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f030653c000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f0306325000)
        libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007f0305fc9000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f0305c55000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0305a37000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0307b51000)

--- End Message ---
--- Begin Message ---
On Wed, Mar 21, 2012 at 3:32 PM, Meike Stone <meike.st...@googlemail.com> wrote:
>>
>> But what is the reason, that the module not work properly?
>> Which next step can I do?
>
> I figured out, that the new mod_php5.so is not linked against
> libmm.so.14. Can this be the problem?
>
> Thanks Meike
>
> # ldd mod_php5.so.5.3.8
>        linux-vdso.so.1 =>  (0x00007fffe051c000)
>        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f3d30f82000)
>        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f3d30d6b000)
>        libpcre.so.0 => /usr/lib64/libpcre.so.0 (0x00007f3d30b3a000)
>        librt.so.1 => /lib64/librt.so.1 (0x00007f3d30931000)
>        libm.so.6 => /lib64/libm.so.6 (0x00007f3d306b8000)
>        libdl.so.2 => /lib64/libdl.so.2 (0x00007f3d304b3000)
>        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f3d3029b000)
>        libz.so.1 => /lib64/libz.so.1 (0x00007f3d30085000)
>        libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007f3d2fd28000)
>        libc.so.6 => /lib64/libc.so.6 (0x00007f3d2f9b4000)
>        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f3d2f797000)
>        /lib64/ld-linux-x86-64.so.2 (0x00007f3d31c0f000)
>
> # ldd mod_php5.so.5.2.14
>        linux-vdso.so.1 =>  (0x00007fffcdfff000)
>        libmm.so.14 => /usr/lib64/libmm.so.14 (0x00007f0307223000)
>        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f0307428000)
>        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f0306bd2000)
>        libpcre.so.0 => /usr/lib64/libpcre.so.0 (0x00007f0306ff2000)
>        librt.so.1 => /lib64/librt.so.1 (0x00007f0306de9000)
>        libm.so.6 => /lib64/libm.so.6 (0x00007f0306958000)
>        libdl.so.2 => /lib64/libdl.so.2 (0x00007f0306754000)
>        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f030653c000)
>        libz.so.1 => /lib64/libz.so.1 (0x00007f0306325000)
>        libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00007f0305fc9000)
>        libc.so.6 => /lib64/libc.so.6 (0x00007f0305c55000)
>        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0305a37000)
>        /lib64/ld-linux-x86-64.so.2 (0x00007f0307b51000)

I believe using libmm is optional, and the package maintainers
probably had their reasons not to use it anymore. Mine is also
compiled without libmm, though I'm on 5.3.10. Is it possible for you
to upgrade to the latest version? That might solve the problem too, if
not, I suggest to stick with the older one for a while. (and maybe
submit a bug report)

- Matijn

--- End Message ---
--- Begin Message ---
Hello.
I ran into trouble with a PEAR module and got only a blank (empty)
page after filling in a loginform with PEAR::Auth
I have error reporting in php.ini that create ordinary error message
on my CentOS box, but it do not write error message when using PEAR.
In a book I have is PEAR_Error mention, but it did not explain how to
get it or run it.

If you can help me in this question I am thankful for your time.

Karl

--- End Message ---
--- Begin Message ---
This is a continuation of the nested query thing I posted to the list a while 
back. I was finally able to output a nested unordered array that worked out 
well, but scope-creep has come in the door and I have to change gears.

I have a project where I have multiple queries and each query uses the results 
from the previous query to get it's results. I need to do one of two things, 
either out put a multidimensional array that I can use json_encode() on or I 
have to format the output from the queries as a JSON string. The resulting JSON 
will be used by a JavaScript widget and must be formed correctly. I created the 
following array by hand:

$userList = array("John" => array(
                     "email" => "j...@demo.com",
                     "website" => "www.john.com",
                     "age" => "22",
                     "password" => "pass",
                     "description" => array(
                        "hair" => "blonde",
                        "eyes" => "blue",
                        "build" => "medium"
                     )),
                  "Anna" => array(
                     "email" => "a...@demo.com",
                     "website" => "www.anna.com",
                     "age" => "24",
                     "password" => "pass",
                     "description" => array(
                        "hair" => "brunette",
                        "eyes" => "hazel",
                        "build" => "petite"
                        )
                     ));  

I ran it through json_encode() and got the following output

{"John":{"email":"j...@demo.com","website":"www.john.com","age":"22","password":"pass","description":{"hair":"blonde","eyes":"blue","build":"medium"}},"Anna":{"email":"a...@demo.com","website":"www.anna.com","age":"24","password":"pass","description":{"hair":"brunette","eyes":"hazel","build":"petite"}}}

jslint.com verifies this as good JSON (although I thought there had to be 
square brackets around child arrays).

If you were me would you just generate the JSON? If not what is he best way to 
output an array that will nest properly for each subsequent query?

Thanks for any insight!



--- End Message ---
--- Begin Message ---
On Wed, Mar 21, 2012 at 2:39 PM, Jay Blanchard
<jay.blanch...@sigmaphinothing.org> wrote:
> ...
> I have a project where I have multiple queries and each query uses the 
> results from the previous query to get it's results. I need to do one of two 
> things, either out put a multidimensional array that I can use json_encode() 
> on or I have to format the output from the queries as a JSON string. The 
> resulting JSON will be used by a JavaScript widget and must be formed 
> correctly. I created the following array by hand:
>
> $userList = array("John" => array(
>                     "email" => "j...@demo.com",
>                     "website" => "www.john.com",
>                     "age" => "22",
>                     "password" => "pass",
>                     "description" => array(
>                        "hair" => "blonde",
>                        "eyes" => "blue",
>                        "build" => "medium"
>                     )),
>                  "Anna" => array(
>                     "email" => "a...@demo.com",
>                     "website" => "www.anna.com",
>                     "age" => "24",
>                     "password" => "pass",
>                     "description" => array(
>                        "hair" => "brunette",
>                        "eyes" => "hazel",
>                        "build" => "petite"
>                        )
>                     ));
>
> I ran it through json_encode() and got the following output
>
> {"John":{"email":"j...@demo.com","website":"www.john.com","age":"22","password":"pass","description":{"hair":"blonde","eyes":"blue","build":"medium"}},"Anna":{"email":"a...@demo.com","website":"www.anna.com","age":"24","password":"pass","description":{"hair":"brunette","eyes":"hazel","build":"petite"}}}
>
> jslint.com verifies this as good JSON (although I thought there had to be 
> square brackets around child arrays).

Speaking to your belief that arrays had to have square brackets,
json_encode examines the PHP array and only encodes sequential numbers
JSON arrays. Others (as in your case) are encoded as object literals:
http://php.net/manual/en/function.json-encode.php

That said, you can still access Javascript Object properties with
array access if you prefer in the client code:
http://www.quirksmode.org/js/associative.html

> If you were me would you just generate the JSON? If not what is he best way 
> to output an array that will nest properly for each subsequent query?

Because of the options json_encode provides and the flexibility it
affords while in PHP, I would generate PHP and then always use
json_encode to generate the JSON as needed.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
On Wed, Mar 21, 2012 at 14:39, Jay Blanchard
<jay.blanch...@sigmaphinothing.org> wrote:
[snip!]
> I ran it through json_encode() and got the following output
>
> {"John":{"email":"j...@demo.com","website":"www.john.com","age":"22","password":"pass","description":{"hair":"blonde","eyes":"blue","build":"medium"}},"Anna":{"email":"a...@demo.com","website":"www.anna.com","age":"24","password":"pass","description":{"hair":"brunette","eyes":"hazel","build":"petite"}}}
>
> jslint.com verifies this as good JSON (although I thought there had to be 
> square brackets around child arrays).
>
> If you were me would you just generate the JSON? If not what is he best way 
> to output an array that will nest properly for each subsequent query?

    I would, yes, but that's not the point.  Is Anna single?  I'm
ready to trade Debs in for a newer model.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

--- End Message ---
--- Begin Message ---
[snip]
>    I would, yes, but that's not the point.  Is Anna single?  I'm
> ready to trade Debs in for a newer model.
[/snip]

I'm thinking that Debs would upset your array if you traded her in. 

Anyhow, I have spent the last hour trying to output valid JSON but the whole 
thing is making me barking mad. I may try create a multidimensional array here 
in a little bit. After I go for a walk.

--- End Message ---
--- Begin Message ---
On 12-03-21 03:52 PM, Jay Blanchard wrote:
[snip]
    I would, yes, but that's not the point.  Is Anna single?  I'm
ready to trade Debs in for a newer model.
[/snip]

I'm thinking that Debs would upset your array if you traded her in.

Anyhow, I have spent the last hour trying to output valid JSON but the whole 
thing is making me barking mad. I may try create a multidimensional array here 
in a little bit. After I go for a walk.

Hi Jay,

Why are you trying to create the JSON structure in parts? When I have nesting like this i build the full nested structure as PHP, then export to JSON.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--- End Message ---
--- Begin Message ---
[snip]
> Why are you trying to create the JSON structure in parts? When I have nesting 
> like this i build the full nested structure as PHP, then export to JSON.
[/snip]

As PHP? An array?


--- End Message ---
--- Begin Message ---
On 03/21/2012 11:39 AM, Jay Blanchard wrote:

If you were me would you just generate the JSON? If not what is he best way to 
output an array that will nest properly for each subsequent query?

Depends on where the data is coming from and how you are retrieving it from.

Can you provide examples of the code that retrieves the data and some of the actual output data? Then provide a structure that you want the data to look like when done.

--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

--- End Message ---
--- Begin Message ---
On 12-03-21 04:42 PM, Jay Blanchard wrote:
[snip]
Why are you trying to create the JSON structure in parts? When I have nesting 
like this i build the full nested structure as PHP, then export to JSON.
[/snip]

As PHP? An array?

Yeah sorry... you know what I meant ;)

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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

So i had my first Hackathon at work last week and my project was to
prototype making a node.js clone using PHP instead of V8. So i
snatched up libuv and joyent's HTTP parser and set off on a 24 hour
coding spree to get something workable. By the time the sun was coming
out the next morning the following code was working.

    <?php

    $http = new node_http();

    $http->listen(8080, function($request, $response) {
        $response->end("yay, super awesome response");
    });

    nodephp_run();

    ?>

The C code that powers it was whipped together really fast and is kind
of hackish as a result. The code has some memory leaks that i haven't
had time to fully track down yet. Some small portions of the code were
borrowed from the phode project.

In a naive benchmark on this simple server VS an equally simple server
in node.js this implementation already out performs node.js in
throughput by being able to serve just under 200% the amount of
requests per second that node.js could. Take that with a grain of salt
though because node.js has much more feature and is much more hardend
from production use. I do believe the PHP binary will have some major
performance gains over V8 as crossing the PHP <--> C barrier seems to
be a much lighter operation then crossing the V8 <--> C++ barrier.

Any help or feedback will be greatly appreciated. The projects source
code can be found here: https://github.com/JosephMoniz/node.php

- Joseph Moniz

--- End Message ---

Reply via email to