php-general Digest 26 Sep 2012 06:15:07 -0000 Issue 7980

Topics (messages 319245 through 319256):

Re: install PHP 5.4 by RPM
        319245 by: Jonathan Sundquist
        319247 by: Matijn Woudt

Re: memory allocation
        319246 by: Matijn Woudt
        319248 by: Marcelo Bianchi
        319249 by: Marcelo Bianchi
        319250 by: shiplu
        319251 by: shiplu
        319252 by: Marcelo Bianchi
        319254 by: Maciek Sokolewicz

SOAP problem
        319253 by: George Pitcher

Vulnerability Announced in phpMyAdmin
        319255 by: Daniel Brown
        319256 by: tamouse mailing lists

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 ---
What version of centso are you running?

- "The cold winds are rising"
On Sep 24, 2012 10:28 PM, "lx" <lxlenovos...@gmail.com> wrote:

> Hello:
>        I have installed the PHP and Apache by RPM, and the version of rpm
> packets is:
>
> httpd-2.2.3-63.el5.centos.1.x86_64.rpm
> apr-1.2.7-11.el5_3.1.x86_64.rpm
> apr-util-1.2.7-11.el5.x86_64.rpm
> postgresql-libs-8.1.18-2.el5_4.1.x86_64.rpm
> gmp-4.1.4-10.el5.x86_64.rpm
> php-common-5.1.6-27.el5.x86_64.rpm
> php-cli-5.1.6-27.el5.x86_64.rpm
> php-5.1.6-27.el5.x86_64.rpm
>
>      As you see, this version of PHP is 5.1.6, so I want to installed PHP
> 5.4.
> I want to know the list of PHP 5.4 RPM packets, these can replace the
>  php-common-5.1.6-27.el5.x86_64.rpm,
> php-cli-5.1.6-27.el5.x86_64.rpm and php-5.1.6-27.el5.x86_64.rpm.
>
> Thank you.
>

--- End Message ---
--- Begin Message ---
On Tue, Sep 25, 2012 at 1:48 PM, Jonathan Sundquist
<jsundqu...@gmail.com> wrote:
> What version of centso are you running?
>
> - "The cold winds are rising"
> On Sep 24, 2012 10:28 PM, "lx" <lxlenovos...@gmail.com> wrote:
>
>> Hello:
>>        I have installed the PHP and Apache by RPM, and the version of rpm
>> packets is:
>>
>> httpd-2.2.3-63.el5.centos.1.x86_64.rpm
>> apr-1.2.7-11.el5_3.1.x86_64.rpm
>> apr-util-1.2.7-11.el5.x86_64.rpm
>> postgresql-libs-8.1.18-2.el5_4.1.x86_64.rpm
>> gmp-4.1.4-10.el5.x86_64.rpm
>> php-common-5.1.6-27.el5.x86_64.rpm
>> php-cli-5.1.6-27.el5.x86_64.rpm
>> php-5.1.6-27.el5.x86_64.rpm
>>
>>      As you see, this version of PHP is 5.1.6, so I want to installed PHP
>> 5.4.
>> I want to know the list of PHP 5.4 RPM packets, these can replace the
>>  php-common-5.1.6-27.el5.x86_64.rpm,
>> php-cli-5.1.6-27.el5.x86_64.rpm and php-5.1.6-27.el5.x86_64.rpm.
>>
>> Thank you.
>>

You should try the packages from the ius community, for x86_64
CentOS/RHEL 5 they are here:
http://mirrors.ircam.fr/pub/ius/stable/Redhat/5/x86_64/
(look for the packages starting with php54-)

- Matijn

--- End Message ---
--- Begin Message ---
On Tue, Sep 25, 2012 at 12:49 PM, Marcelo Bianchi
<mbian...@gfz-potsdam.de> wrote:
> Dear list,
>
> I developed a script that have to create considerable array of integer
> numbers in memory. Currently my script has to accommodate in memory two
> arrays of around 120.000 numbers (for one year of data, I would like to
> reach a 2 years per query) that are loaded from a mysql server.
>
> I developed the script on a ubuntu 32bit machine and when I bring this
> script to our server, a 64bit opensuse the normal 128M of memory limit from
> php was exhausted.
>
> On my ubuntu system the script was consuming around 30Mb of memory / year,
> on the opensuse to run the same script it consumes more than 90Mb / year of
> memory.
>
> Is there a way to reduce this memory consumption on a 64bits machine ?
>
> Also, I made a test with four different virtual box machines (two opensuse
> and two ubuntu machines with the same PHP version, opensuse 11.4 and ubuntu
> 11.04 all running php-5.3.5) and it was quite choking the result for me. I
> am still wandering what is the difference between those and how to explain
> the results.
>
> A print screen of my machine running the four virtual boxes can be seen at:
>
> https://sites.google.com/site/foo4funreborn/phpcomp
>
> I would greatly thanks any help,
> with my best regards,
>
> Marcelo Bianchi

Hi,

If you suspect it's because of 64bits, you can always install 32bit
PHP next to the 64bit version. At some point Ubuntu should support
this out of the box with apt-get, but it seems that it's broken,
atleast for now. Other than that, there's probably little you can do,
as PHP will use 64bit integers and 64bit pointers internally, and
there's pretty much nothing you can do about that.

What I would suggest is just change the memory limit of PHP, you can
do that with ini_set inside the PHP script. I assume you have plenty
of ram in the system? If not, you should probably just go back to
32bit OS.

- Matijn

--- End Message ---
--- Begin Message ---
Hi Matijn,

That is good test, to install php 32bit side to side with the 64bit to test. Will see how hard is to accomplish that.

regards,

Marcelo

On 09/25/2012 01:58 PM, Matijn Woudt wrote:
On Tue, Sep 25, 2012 at 12:49 PM, Marcelo Bianchi
<mbian...@gfz-potsdam.de> wrote:
Dear list,

I developed a script that have to create considerable array of integer
numbers in memory. Currently my script has to accommodate in memory two
arrays of around 120.000 numbers (for one year of data, I would like to
reach a 2 years per query) that are loaded from a mysql server.

I developed the script on a ubuntu 32bit machine and when I bring this
script to our server, a 64bit opensuse the normal 128M of memory limit from
php was exhausted.

On my ubuntu system the script was consuming around 30Mb of memory / year,
on the opensuse to run the same script it consumes more than 90Mb / year of
memory.

Is there a way to reduce this memory consumption on a 64bits machine ?

Also, I made a test with four different virtual box machines (two opensuse
and two ubuntu machines with the same PHP version, opensuse 11.4 and ubuntu
11.04 all running php-5.3.5) and it was quite choking the result for me. I
am still wandering what is the difference between those and how to explain
the results.

A print screen of my machine running the four virtual boxes can be seen at:

https://sites.google.com/site/foo4funreborn/phpcomp

I would greatly thanks any help,
with my best regards,

Marcelo Bianchi

Hi,

If you suspect it's because of 64bits, you can always install 32bit
PHP next to the 64bit version. At some point Ubuntu should support
this out of the box with apt-get, but it seems that it's broken,
atleast for now. Other than that, there's probably little you can do,
as PHP will use 64bit integers and 64bit pointers internally, and
there's pretty much nothing you can do about that.

What I would suggest is just change the memory limit of PHP, you can
do that with ini_set inside the PHP script. I assume you have plenty
of ram in the system? If not, you should probably just go back to
32bit OS.

- Matijn



--- End Message ---
--- Begin Message ---
Uhm, Okay,

I get it ... I am loading all at once, will try this out.

Here is what I do:

-- begin code
$network = "IA";
$station = "BJI";
$channel = "BHZ";
$year = 2011;

$top = NULL;

$result = mysql_query('select '.$year.' as year, net, station, loc, channel, start_day, start_time, end_day, end_time from data_'.$year.' where net = "'.$network.'" and station = "'.$station.'" and scal_date BETWEEN "'.$year.'-01-01" AND "'.$year.'-12-31" and channel = "'.$channel.'" ') or die(mysql_error());

echo "Loading $year ... ";
while ($r = mysql_fetch_array($result, MYSQL_ASSOC)) {
        if ($top === NULL)
                $top = new Segments($r, 120);
        $top->add($r);
        unset ($r);
}
echo "Done\n";

echo "Nothing free: ".memory_get_usage(True)." \n";
mysql_free_result($result);
mysql_close($db_link);
unset($result);
echo "SQL free: ".memory_get_usage(True)." \n";
unset($top);
echo "Segments free: ".memory_get_usage(True)." \n";
-- end code

The Segments object is a class with some functionality but, after processing the results of each row it stores two integers (or floats due to the large numbers, number of seconds from epoch * 10000.0 + microseconds).

I will try to implement this chunk mode of fetching the data from sql to see if the php consumption goes down.

regards,

Marcelo

On 09/25/2012 02:23 PM, shiplu wrote:
I would like to see how you are reading data from database?


There are many ways to reduce memory usage. Here is a very common way
reduce memory.

instead of

$res = mysql_query("select * from table1 limit 10000000");
while($row = mysql_fetch_assoc($res)){
  /// process row.
}

Do this,

for($x = 0; $x< 10000000; $x+=100;}
     $res = mysql_query(sprintf("select required_col1,  required_col2,
...  from table1 limit %d, %d",$x, 100));
     while($row = mysql_fetch_assoc($res)){
         /// process row.
     }
}



--
Shiplu.Mokadd.im <http://Shiplu.Mokadd.im>
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader



--- End Message ---
--- Begin Message ---
Also if the final data on presentation layer is very small you can
calculate it in mysql using stored procedure.

-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader

--- End Message ---
--- Begin Message ---
I would like to see how you are reading data from database?


There are many ways to reduce memory usage. Here is a very common way
reduce memory.

instead of

$res = mysql_query("select * from table1 limit 10000000");
while($row = mysql_fetch_assoc($res)){
 /// process row.
}

Do this,

for($x = 0; $x< 10000000; $x+=100;}
    $res = mysql_query(sprintf("select required_col1,  required_col2,
...  from table1 limit %d, %d",$x, 100));
    while($row = mysql_fetch_assoc($res)){
        /// process row.
    }
}



-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader

--- End Message ---
--- Begin Message ---
On 09/25/2012 02:40 PM, shiplu wrote:
Also if the final data on presentation layer is very small you can
calculate it in mysql using stored procedure.

okay, also something to try.
thank you !
regards,
marcelo

--- End Message ---
--- Begin Message ---
On 25-09-2012 12:49, Marcelo Bianchi wrote:
Dear list,

I developed a script that have to create considerable array of integer
numbers in memory. Currently my script has to accommodate in memory two
arrays of around 120.000 numbers (for one year of data, I would like to
reach a 2 years per query) that are loaded from a mysql server.

I developed the script on a ubuntu 32bit machine and when I bring this
script to our server, a 64bit opensuse the normal 128M of memory limit
from php was exhausted.

On my ubuntu system the script was consuming around 30Mb of memory /
year, on the opensuse to run the same script it consumes more than 90Mb
/ year of memory.

Is there a way to reduce this memory consumption on a 64bits machine ?

Also, I made a test with four different virtual box machines (two
opensuse and two ubuntu machines with the same PHP version, opensuse
11.4 and ubuntu 11.04 all running php-5.3.5) and it was quite choking
the result for me. I am still wandering what is the difference between
those and how to explain the results.

A print screen of my machine running the four virtual boxes can be seen at:

https://sites.google.com/site/foo4funreborn/phpcomp

I would greatly thanks any help,
with my best regards,

Marcelo Bianchi

A while ago, there was a post on the php.internals list with a similar problem. An explanation was provided why arrays tend to grow huge when you keep appending small parts to it.

I won't repeat what it was exactly, but you can read the thread here: http://marc.info/?l=php-internals&m=133762629930776&w=2

It mainly talks about objects at the start, but it's about arrays further on.

One option it gives, is to use SplFixedArray to fix the total amount of memory you expect it to use, and thus limit it (a lot).

- Tul

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

My first post for several years. Using PHP 5.2.6 on Debian.

I'm trying to connect to an external SOAP server where no WSDL file exists. 
I've been unsuccessful in getting a response which I've put down to the message 
being sent.

My code is:

$params = array(
                                'RequestSystem'              => 
'PackTrackerTest',
                                'SenderName'                   => 'George',
                                'MessageId'                        => '1234'
                     );
$client = new SoapClient(null, array(
'soap_version' => 'SOAP_1_2',
                'location' => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                'uri'      => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
                'trace'    => TRUE, ));
                $result = 
$client->__soapCall("GetReferenceData",array("GetReferenceData"=>$params));

Which generates the following message:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:ns2="http://xml.apache.org/xml-soap"; 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
                <SOAP-ENV:Body>
                                <ns1:GetReferenceData>
                                                <param0 xsi:type="ns2:Map">
                                                                <item>
                                                                                
<key xsi:type="xsd:string">RequestSystem</key>
                                                                                
<value xsi:type="xsd:string">PackTrackerTest</value>
                                                                </item>
                                                                <item>
                                                                                
<key xsi:type="xsd:string">SenderName</key>
                                                                                
<value xsi:type="xsd:string">George</value>
                                                                </item>
                                                                <item>
                                                                                
<key xsi:type="xsd:string">MessageId</key>
                                                                                
<value xsi:type="xsd:string">1234</value>
                                                                </item>
                                                </param0>
                                </ns1:GetReferenceData>
                </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The SOAP server is expecting to get something like:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"; 
xmlns:v1="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX">
                <soap:Body>
                                <v1:GetReferenceData>
                                         <v1:RequestParameters>
                                      <RequestParameters xmlns="">
                                                <RequestSystem> PackTrackerTest 
</RequestSystem>
                                                  <SenderName> George 
</SenderName>
                                                <MessageId>1024</MessageId>
                                            </RequestParameters>
                                    </v1:RequestParameters>
                                </v1:GetReferenceData>
                </soap:Body>
</soap:Envelope>


Does anyone have any suggestions as to how I can format my xml message 
accordingly?

MTIA

George

The information in this message is intended solely for the addressee and should 
be considered confidential.  Publishing Technology does not accept legal 
responsibility for the contents of this message and any statements contained 
herein which do not relate to the official business of Publishing Technology 
are neither given nor endorsed by Publishing Technology and are those of the 
individual and not of Publishing Technology. This message has been scanned for 
viruses using the most current and reliable tools available and Publishing 
Technology excludes all liability related to any viruses that might exist in 
any attachment or which may have been acquired in transit.

--- End Message ---
--- Begin Message ---
    Afternoon, folks;

    Just a three-list cross-post to bring it to everyone's attention
at once, in case you weren't already aware.  It was announced today
that a compromised SourceForge mirror was distributing a malicious
file with the phpMyAdmin package that allows an attacker to
arbitrarily execute code on a server hosting the exploitable package.
Obligatory (not intentionally self-serving) social media link here:

        https://twitter.com/oidk/status/250688002005811200

    I don't especially know how this might affect other projects that
are hosting on the same mirror, but I hope at least some of the more
popular projects will take a moment to verify the integrity of their
packages on the affected mirror ('cdnetworks-kr-1' mirror in Korea,
for those interested).

    Those of you who have phpMyAdmin installed should check
immediately to see if your installation is vulnerable to the exploit,
particularly if it's auto-updated or has been installed or updated
recently.

    We now return you to your regularly-scheduled Tuesday (unless
you're east of the EEST time zone, in which case, Happy Hump Day).

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

--- End Message ---
--- Begin Message ---
On Tue, Sep 25, 2012 at 3:20 PM, Daniel Brown <danbr...@php.net> wrote:
>     Just a three-list cross-post to bring it to everyone's attention
> at once, in case you weren't already aware.  It was announced today
> that a compromised SourceForge mirror was distributing a malicious
> file with the phpMyAdmin package that allows an attacker to
> arbitrarily execute code on a server hosting the exploitable package.
> Obligatory (not intentionally self-serving) social media link here:
>
>         https://twitter.com/oidk/status/250688002005811200
>

Signal boosting...

--- End Message ---

Reply via email to