php-general Digest 14 Sep 2012 08:51:58 -0000 Issue 7963
Topics (messages 319067 through 319081):
Re: Programmers and developers needed
319067 by: Tedd Sperling
319068 by: Ashley Sheridan
319072 by: Jim Giner
319075 by: Kiek Bailey
319081 by: Serge Fonville
PHP 5.4.7 and PHP 5.3.17 released!
319069 by: Johannes Schlüter
Re: How to limit source IP in PHP
319070 by: Jim Lucas
319071 by: Tonix (Antonio Nati)
319074 by: tamouse mailing lists
PHP Threading on Windows
319073 by: admin
319077 by: tamouse mailing lists
Re: [PHP-DB] Prepared Statements - Search
319076 by: tamouse mailing lists
Re: PHP array unions
319078 by: Adam Richardson
319079 by: Matijn Woudt
319080 by: Adam Richardson
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 ---
On Sep 13, 2012, at 3:45 AM, agbo onyador <onya...@gmail.com> wrote:
> Hello there! We are looking for programmers and developers to create a
> world wide system. Your comments are welcome.
Wow!
I'm looking for world wide money.
tedd
_____________________
t...@sperling.com
http://sperling.com
--- End Message ---
--- Begin Message ---
On Thu, 2012-09-13 at 16:48 -0400, Tedd Sperling wrote:
> On Sep 13, 2012, at 3:45 AM, agbo onyador <onya...@gmail.com> wrote:
>
> > Hello there! We are looking for programmers and developers to create a
> > world wide system. Your comments are welcome.
>
> Wow!
>
> I'm looking for world wide money.
>
>
> tedd
>
> _____________________
> t...@sperling.com
> http://sperling.com
>
Join the queue...
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On 9/13/2012 3:45 AM, agbo onyador wrote:
Hello there! We are looking for programmers and developers to create a
world wide system. Your comments are welcome.
really?? A "world wide system"? And this is how you advertise it?
--- End Message ---
--- Begin Message ---
On 9/13/2012 7:39 PM, Jim Giner wrote:
On 9/13/2012 3:45 AM, agbo onyador wrote:
Hello there! We are looking for programmers and developers to create a
world wide system. Your comments are welcome.
really?? A "world wide system"? And this is how you advertise it?
I thiknk he's still building it, not advertising it. Still, methinks i
detect a bit of a whiff, but it could be my pits...
--- End Message ---
--- Begin Message ---
2012/9/14 Kiek Bailey <kbai...@howlermonkey.net>
> On 9/13/2012 7:39 PM, Jim Giner wrote:
>
>> On 9/13/2012 3:45 AM, agbo onyador wrote:
>>
>>> Hello there! We are looking for programmers and developers to create a
>>> world wide system. Your comments are welcome.
>>>
>>> really?? A "world wide system"? And this is how you advertise it?
>>
>> I thiknk he's still building it, not advertising it. Still, methinks i
> detect a bit of a whiff, but it could be my pits...
Or the fact that since the 'announcement' , there were no further responses
from him (her?)
Kind regards/met vriendelijke groet,
Serge Fonville
http://www.sergefonville.nl
Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table
2012/9/14 Kiek Bailey <kbai...@howlermonkey.net>
> On 9/13/2012 7:39 PM, Jim Giner wrote:
>
>> On 9/13/2012 3:45 AM, agbo onyador wrote:
>>
>>> Hello there! We are looking for programmers and developers to create a
>>> world wide system. Your comments are welcome.
>>>
>>> really?? A "world wide system"? And this is how you advertise it?
>>
>> I thiknk he's still building it, not advertising it. Still, methinks i
> detect a bit of a whiff, but it could be my pits...
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
The PHP development team announces the immediate availability of PHP
5.4.7 and PHP 5.3.17. These releases fix over 20 bugs. All users of PHP
are encouraged to upgrade to PHP 5.4.6, or at least 5.3.16.
Key enhancements in these releases include:
* Fixed bug #62955 (Only one directive is loaded from "Per Directory
Values" Windows registry).
* Fixed bug #62460 (php binaries installed as binary.dSYM).
The full list of changes are recorded in the ChangeLog on
http://www.php.net/ChangeLog-5.php
For source downloads of PHP 5.4.7 and PHP 5.3.17 please visit our
downloads page at http://www.php.net/downloads.php
Windows binaries can be found on http://windows.php.net/download/
David Soria Parra, Stanislav Malyshev and Johannes Schlüter
PHP Release Team
--- End Message ---
--- Begin Message ---
On 09/13/2012 12:55 PM, Tonix (Antonio Nati) wrote:
Il 13/09/2012 21:41, Jim Lucas ha scritto:
On 09/13/2012 12:28 PM, Tonix (Antonio Nati) wrote:
You are speaking about incoming connections, I suppose.
I'm speaking about connections started from within PHP.
Which is a response to the incoming connection.
And so? There is no relation between the call received from Apache
(which is not passed to PHP), and any connection PHP may open later.
My experience has always been, with Apache and lighttpd at least, that
the response comes from the IP:PORT that the request was made to.
So, if I connect to http://10.10.10.10/
Then the response is going to come from PORT 80.
You might want to run a little trafshow on your server to see how the
traffic behaves. I have a number of web servers that I run, all with
either apache or lighttpd, and they all behave this way.
Here is the output of my http request from my office to my server:
From Address To Address Pro Bytes CPS
======================================================================
66.39.178.2..58479 66.39.167.51..80 tcp 725 12
66.39.167.51..80 66.39.178.2..58479 tcp 2720
66.39.178.2..52515 66.39.167.51..80 tcp 1303
66.39.178.2..54506 66.39.167.51..80 tcp 696
66.39.178.2..62658 66.39.167.51..80 tcp 700
66.39.178.2..65382 66.39.167.51..80 tcp 700
66.39.167.51..80 66.39.178.2..52515 tcp 545
66.39.178.2..50794 66.39.167.51..80 tcp 700
66.39.178.2..65015 66.39.167.51..80 tcp 711
66.39.167.51..80 66.39.178.2..54506 tcp 305
66.39.167.51..80 66.39.178.2..62658 tcp 305
66.39.167.51..80 66.39.178.2..65382 tcp 357
66.39.167.51..80 66.39.178.2..50794 tcp 357
66.39.167.51..80 66.39.178.2..65015 tcp 357
This is running Apache.
Unless you are talking about PHP being ran from cron or the CLI.
if you are talking about YOU running a PHP script as a daemon, then
yes, you have the ability to BIND to an IP address. I do this in a few
scripts/daemons of mine. I use the stream_* functions for this.
But, if you are talking about calling fopen() from the CLI and have it
"bind" to a specific IP when connecting out, that is more of a OS
specific option. You will need to find out how to run a php script and
have it "bind" to a given IP (or interface) when it connects to the WWW.
When apache starts a php script, the script can open a socket towards
another end-point, asking to bind to any local address as source address.
But this is a secondary connection (that you open in process) and has
nothing to do with the request connection to the server from the client.
Period.
Regards,
Tonino
--
Jim Lucas
http://www.cmsws.com/
http://www.cmsws.com/examples/
--- End Message ---
--- Begin Message ---
Il 14/09/2012 00:09, Jim Lucas ha scritto:
On 09/13/2012 12:55 PM, Tonix (Antonio Nati) wrote:
Il 13/09/2012 21:41, Jim Lucas ha scritto:
On 09/13/2012 12:28 PM, Tonix (Antonio Nati) wrote:
You are speaking about incoming connections, I suppose.
I'm speaking about connections started from within PHP.
Which is a response to the incoming connection.
And so? There is no relation between the call received from Apache
(which is not passed to PHP), and any connection PHP may open later.
My experience has always been, with Apache and lighttpd at least, that
the response comes from the IP:PORT that the request was made to.
Jim, sorry but you did not read carefully my posts.
Since the fist post, I ALWAYS spoke about connections a PHP script may
open autonomously (what you name second connection).
I'm never speaking about listening/intercepting/using the original HTTP
request.
It is well clear for anyone with a minimum knowledge of programming in
apache that only apache listens and answers from the binded port of httpd.
And, of course, any program/script/binary called from apache, will
return his data to apache, and apache only will send them back to the
original requester.
At the same time it is well clear too that each called
program/script/binary may live autonomously before returning data to
apache, and do whatever action it requires to do, including the opening
of a network socket to an external or internal server.
And this is true for any language, from perl to C to PHP.
Only first two replies understood the initial request, all other just
added confusion to the thread.
Regards,
Tonino
--
------------------------------------------------------------
Inter@zioni Interazioni di Antonio Nati
http://www.interazioni.it to...@interazioni.it
------------------------------------------------------------
--- End Message ---
--- Begin Message ---
Are you looking to use sockets? That's the only thing I can think of
when you speak of binding to an ip address/port...
http://php.net/manual/en/book.sockets.php ?
--- End Message ---
--- Begin Message ---
It has been suggested:
That because php does not support PCNTL threading on Windows that
multiple services of php are an alternative.
I am interested in this theory, if anyone is currently working on a project
that (forks) processes off to another instance or service of PHP on windows
please let me know.
In some of my latest development I have some rather large processes that
consume the single instance of PHP, threading these off would be ideal.
Example:
$tmpsrv=win32_query =win32_create_service(array(
'params' => __FILE__." install",
'service' => 'Name_of_the_service',
'display' => 'Name of service to be displayed in the service list'
));
Any windows php developers have ideas, comments on this suggestion?
--- End Message ---
--- Begin Message ---
On Thu, Sep 13, 2012 at 9:32 PM, admin <ad...@buskirkgraphics.com> wrote:
> It has been suggested:
> That because php does not support PCNTL threading on Windows that
> multiple services of php are an alternative.
>
> I am interested in this theory, if anyone is currently working on a project
> that (forks) processes off to another instance or service of PHP on windows
> please let me know.
> In some of my latest development I have some rather large processes that
> consume the single instance of PHP, threading these off would be ideal.
>
> Example:
> $tmpsrv=win32_query =win32_create_service(array(
> 'params' => __FILE__." install",
> 'service' => 'Name_of_the_service',
> 'display' => 'Name of service to be displayed in the service list'
> ));
>
> Any windows php developers have ideas, comments on this suggestion?
I'm interested in the answer to this as well.
--- End Message ---
--- Begin Message ---
Crud, forgot to include list.
---------- Forwarded message ----------
From: tamouse mailing lists <tamouse.li...@gmail.com>
Date: Thu, Sep 13, 2012 at 10:31 PM
Subject: Re: [PHP-DB] Prepared Statements - Search
To: erosenb...@hygeiabiomedical.com
On Thu, Sep 13, 2012 at 7:09 PM, Ethan Rosenberg, PhD
<erosenb...@hygeiabiomedical.com> wrote:
> Dear List -
>
> Here is another problem I am having with prepared statements. The last one
> was INSERT, this one is SELECT.
>
> Here is the database:
>
> mysql> describe Intake3;
> +--------+-------------+------+-----+---------+-------+
> | Field | Type | Null | Key | Default | Extra |
> +--------+-------------+------+-----+---------+-------+
> | Site | varchar(6) | NO | PRI | | |
> | MedRec | int(6) | NO | PRI | NULL | |
> | Fname | varchar(15) | YES | | NULL | |
> | Lname | varchar(30) | YES | | NULL | |
> | Phone | varchar(30) | YES | | NULL | |
> | Height | int(4) | YES | | NULL | |
> | Sex | char(7) | YES | | NULL | |
> | Hx | text | YES | | NULL | |
> | Bday | date | YES | | NULL | |
> | Age | int(3) | YES | | NULL | |
> +--------+-------------+------+-----+---------+-------+
> 10 rows in set (0.00 sec)
>
> Here is my code:
>
> // Prepare statement
> $stmt = mysqli_stmt_init($cxn);
> $sql11 = "SELECT 'Fname', 'Lname', 'Phone', Height, Hx, Bday, Age FROM
> Intake3 where 1 and (MedRec = ?) and (Site = ?) and (Sex = ?)";
> // Allocates and initializes a statement object suitable for
> mysqli_stmt_prepare().
> // Prepare statement, bind result variables, execute and place results into
> bound result variables
> mysqli_stmt_prepare($stmt, $sql11);
> mysqli_stmt_execute($stmt);
> mysqli_stmt_bind_result($stmt, $Site, $MedRec, $Fname, $Lname, $Phone,
> $Height, $Sex, $Hx, $Bday, $Age); //The error is in this statement.
> while (mysqli_stmt_fetch($stmt)) {
> printf("%s %s %s %s %s %s %s %s %s %s \n", $Site, $MedRec, $Fname,
> $Lname, $Phone, $Height, $Sex, $Hx, $Bday, $Age);
> }
>
> I get no output from the printf statement.
>
> I receive the following error:
>
> Warning: mysqli_stmt_bind_result(): Number of bind variables doesn't match
> number of fields in prepared statement.
>
> The query, with the values inserted, works on the command line
>
> Help and advice, please.
Pay attention to the code you write.
Your SQL SELECT Statement pulls in these fields, in this order:
'Fname'
'Lname'
'Phone'
Height
Hx
Bday
Age
Got that?
Your bind statement binds the following variables:
$Site
$MedRec
$Fname
$Lname
$Phone
$Height
$Sex
$Hx
$Bday
$Age
So, pairing those up, this is the relationship the bind statement sees:
Column -> PHP variable
----------------------
'Fname' -> $Site
'Lname' -> $MedRec
'Phone' -> $Fname
Height -> $Lname
Hx -> $Phone
Bday -> $Height
Age -> $Sex
and oops, out of columns to bind to the remaining items:
??? -> $Hx
??? -> $Bday
??? -> $Age
So, lesson is: the bind results statement must match exactly
one-for-one with each column returned in the SELECT statement.
Additionally, I'm really uncertain the effect of the surrounding
single quotes on 'Fname', 'Lname' and 'Phone' in your SELECT
statement; perhaps they don't matter, but I've never seen that. Column
names such as you show do not need to be quoted, as none of them
represent MySQL key/reserved words, and when you do quote field names
in MySQL, you use the backtick, i.e. "`", not a single quote.
--- End Message ---
--- Begin Message ---
On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs <krebs....@gmail.com> wrote:
> Hi,
>
> In PHP the array is in fact a hash map, but especially it is _used_ for
> nearly everything map-, set-, ...-like thing. So in short: The is no
> operator or built-in function, that merges two arrays _and_ treat them as
> set (instead of the hashmap, what they are). Your solution is the way to go.
Sure, I know about the underlying implementation. I was just hopeful
because several of the array functions handle the maps differently
depending on whether the keys are numeric or string or both.
If I wanted to get cute, I could store the value in the key (e.g.,
array('value 1' => 0, 'value 2' => 0, ...)), and that allows me to use
the '+' operator. In spite of the nice performance benefits of this
approach (leveraging the hashes benefits), the code that utilizes the
arrays becomes quite clunky.
Thanks,
Adam
--- End Message ---
--- Begin Message ---
Op 14 sep. 2012 07:51 schreef "Adam Richardson" <simples...@gmail.com> het
volgende:
>
> On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs <krebs....@gmail.com>
wrote:
> > Hi,
> >
> > In PHP the array is in fact a hash map, but especially it is _used_ for
> > nearly everything map-, set-, ...-like thing. So in short: The is no
> > operator or built-in function, that merges two arrays _and_ treat them
as
> > set (instead of the hashmap, what they are). Your solution is the way
to go.
>
> Sure, I know about the underlying implementation. I was just hopeful
> because several of the array functions handle the maps differently
> depending on whether the keys are numeric or string or both.
>
> If I wanted to get cute, I could store the value in the key (e.g.,
> array('value 1' => 0, 'value 2' => 0, ...)), and that allows me to use
> the '+' operator. In spite of the nice performance benefits of this
> approach (leveraging the hashes benefits), the code that utilizes the
> arrays becomes quite clunky.
>
> Thanks,
>
> Adam
>
It doesn't need to be clunky.. just use array_flip and you've got the old
array again..
-Matijn
--- End Message ---
--- Begin Message ---
On Fri, Sep 14, 2012 at 2:30 AM, Matijn Woudt <tijn...@gmail.com> wrote:
>
> It doesn't need to be clunky.. just use array_flip and you've got the old
> array again..
>
Well, array_flip has it's own potential issues (duplicate values are
lost, so my example of using zeros would not work.) I suppose I could
duplicate the keys as the values (e.g., array('value 1' => 'value 1',
'value 2' => 'value 2', ...).) Then, the keys would allow me to
utilize the nice properties of hash maps whilst maintaining the
ability to work with the values as one normally does in typical array
functions.
Ex:
$a1 = array('apples' => 'apples', 'oranges' => 'oranges', 'pears' => 'pears');
$a2 = array('oranges' => 'oranges', 'kiwi' => 'kiwi');
// can use the union operator without any additional calls and the
performance is stellar
$a3 = $a1 + $a2
// can use the values of the array using the convention that the value
is what you expect to handle/manipulate
foreach ($a3 as $val) {
echo $val
}
Here, the clunkiness is the redundancy in the array, but, as Claude
Shannon has demonstrated, redundancy isn't all bad :)
Adam
--
Nephtali: A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com
--- End Message ---