php-windows Digest 7 Dec 2007 04:50:43 -0000 Issue 3379

Topics (messages 28629 through 28633):

Re: Optimization/Benchmarking tools?
        28629 by: John Mertic
        28630 by: BQ

Re: COM - Problem with Dates
        28631 by: Oliver Espeter

Re: Errors with urlencode and gzcompress
        28632 by: James Crow

php mail function
        28633 by: vikas batra

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 ---
It's mostly trial and error here, and for that you'll want to use any of the
web server benchmarking tools to help out ( such as 'ab' if you are using
apache ).

You might want to google up some of Rasmus's presentations on optimization
to get a better idea on what to do. Here's a good one to get started on
http://talks.php.net/show/tortech04/26.

John

On Dec 6, 2007 11:08 AM, Lewis Kapell <[EMAIL PROTECTED]> wrote:

> John,
>
> Thanks for the tip.  In just a short time, this tool helped me to find
> the big bottlenecks in my scripts.
>
> However, as far as I can tell, the Xdebug profiler gives no information
> on the loading/parsing phase of PHP script execution.  I would like to
> determine how much benefit I can get by taking steps to reduce PHP file
> sizes, for example (removing comments, breaking up large classes into
> several files, etc.) or by refactoring the code so that I can use
> exclusively require() instead of require_once().
>
> Can anyone suggest a tool for measuring this?
>
> Thank you,
>
> Lewis Kapell
> Computer Operations
> Seton Home Study School
>
>
> John Mertic wrote:
> > Xdebug and WinCacheGrind are your friends here. Read more at
> > http://xdebug.org/docs/profiler.
> >
> > John
> >
> > On Dec 5, 2007 11:01 AM, Lewis Kapell <[EMAIL PROTECTED]> wrote:
> >
> >> Hello all,
> >>
> >> I have a couple of web sites which rely heavily on PHP and PostgreSQL.
> >> Sometimes, pages which have a lot of dynamic content take several
> >> seconds to load.
> >>
> >> In order to improve my sites' performance, I need to know where the
> >> bottlenecks are.  I need a tool or tools that would allow me to analyze
> >> my sites' behavior to determine where my optimization efforts should be
> >> focused: should it be on the PHP scripts, on the SQL queries or
> database
> >> configuration, on aspects of the server configuration, etc.
> >>
> >> I am using PostgreSQL 8.2.5, PHP 5.2.5, and Microsoft Internet
> >> Information Server (IIS) 6.0.
> >>
> >> I have the Postgres server set up to record any queries whose execution
> >> takes longer than a certain interval.  By inspecting the logs, I was
> >> able to identify poorly performing queries; in most cases, creation of
> >> appropriate table indexes resolved the problem.  So, that is one aspect
> >> of server optimization that I think I have already done pretty well.
> >> Other than that, however, I don't really know where improvements need
> to
> >> be made.
> >>
> >> Thanks to any who can advise.
> >>
> >> --
> >>
> >> Thank you,
> >>
> >> Lewis Kapell
> >> Computer Operations
> >> Seton Home Study School
> >>
> >> --
> >> PHP Windows Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
John Mertic
[EMAIL PROTECTED]
http://jmertic.wordpress.com

"Explaining a joke is like dissecting a frog: you understand it better, but
the frog dies
in the process." --Mark Twain

--- End Message ---
--- Begin Message ---
i wish i could tell you a benchmark tool, but I don’t really know one. 

if u find something, please let me know.

one think what you could / should do is to encode the php scripts.

If u encrypt it or not, its up to you, but note, if u encode php scripts you
can save up to 60% of the speed (and even memory), because the most time
which is passing by, while your script starts, is the time which php needs
to parse, check and interpret the script in bytecode. After the script is in
bytecode php run the script. By encoding your script these steps falls away,
cz the encoder save the php scripts directly in bytecode :)

greetz

ghostwriter

-----Ursprüngliche Nachricht-----
Von: Lewis Kapell [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 6. Dezember 2007 17:09
An: [EMAIL PROTECTED]
Betreff: Re: [PHP-WIN] Optimization/Benchmarking tools?

John,

Thanks for the tip.  In just a short time, this tool helped me to find 
the big bottlenecks in my scripts.

However, as far as I can tell, the Xdebug profiler gives no information 
on the loading/parsing phase of PHP script execution.  I would like to 
determine how much benefit I can get by taking steps to reduce PHP file 
sizes, for example (removing comments, breaking up large classes into 
several files, etc.) or by refactoring the code so that I can use 
exclusively require() instead of require_once().

Can anyone suggest a tool for measuring this?

Thank you,

Lewis Kapell
Computer Operations
Seton Home Study School


John Mertic wrote:
> Xdebug and WinCacheGrind are your friends here. Read more at
> http://xdebug.org/docs/profiler.
> 
> John
> 
> On Dec 5, 2007 11:01 AM, Lewis Kapell <[EMAIL PROTECTED]> wrote:
> 
>> Hello all,
>>
>> I have a couple of web sites which rely heavily on PHP and PostgreSQL.
>> Sometimes, pages which have a lot of dynamic content take several
>> seconds to load.
>>
>> In order to improve my sites' performance, I need to know where the
>> bottlenecks are.  I need a tool or tools that would allow me to analyze
>> my sites' behavior to determine where my optimization efforts should be
>> focused: should it be on the PHP scripts, on the SQL queries or database
>> configuration, on aspects of the server configuration, etc.
>>
>> I am using PostgreSQL 8.2.5, PHP 5.2.5, and Microsoft Internet
>> Information Server (IIS) 6.0.
>>
>> I have the Postgres server set up to record any queries whose execution
>> takes longer than a certain interval.  By inspecting the logs, I was
>> able to identify poorly performing queries; in most cases, creation of
>> appropriate table indexes resolved the problem.  So, that is one aspect
>> of server optimization that I think I have already done pretty well.
>> Other than that, however, I don't really know where improvements need to
>> be made.
>>
>> Thanks to any who can advise.
>>
>> --
>>
>> Thank you,
>>
>> Lewis Kapell
>> Computer Operations
>> Seton Home Study School
>>
>> --
>> PHP Windows Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

__________ NOD32 2706 (20071206) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com

--- End Message ---
--- Begin Message ---
> Hi,
> I have problems fetching data from an special database over a com-based 
> sdk. With VisualBasic it's not a problem,
> but the same code doesn't work with php.
>
> First some Data:
> - The database system holds high compressed industrial data and is called 
> OSI-PI. The system itself is under a
> comercial license (OSI Soft Inc.).
> - The distributor gave us a sdk - fully OO.
> - The sdk has to be integrated over COM.
> - My 1. testsystem: Windows 2000 Professional Version 5.00.2195 with php 
> 5.2.2
> - My 2. testsystem: Windows 2003 Server with php 5.2.4
>
> Here a code-sniplet from me that work:
> 1  <?php
> 2  $comObjPi = new COM('PISDK.PISDK');
> 3  $server = $comObjPi->Servers->Item("123.123.123.123");
> 4  $server->Open("123.123.123.123;UID=foo;pwd=bar");
> 5  $point = $server->PIPoints("SINUSOID");
> 6  echo "\n".$point->Data->SnapShot()->Value."\n";
> 7 echo "\n".$point->Data->SnapShot()->TimeStamp."\n";
> 8 ?>
>
> Line 2 makes an object from the sdk. Line 3 and 4 builds up the connection 
> to the server. Line 5 connects to
> an datapoint (PI-Point/Sinosoid is a testpoint). Line 6 and 7 receive the 
> last value and the last time that are stored
> in the point. Everything WORKS FINE.
>
> But when we use some other functions of the sdk, php throws some 
> exceptions:
>
> 9  com_load_typelib('PISDK.PISDK');
> 10  echo "\nTest 1:\n";
> 11  try{
> 12   $value = $point->Data->ArcValue(new Variant(mktime(), VT_R8), 
> rtBefore);
> 13  }
> 14  catch(Exception $e){
> 15   print("\nException Versuch 1 ".$e->getMessage()." TraceString: 
> ".$e->getTraceAsString());
> 16  }
> 17
> 18  echo "\nTest 2:\n";
> 19  try{
> 20   $value = 
> $point->Data->ArcValue(variant_date_from_timestamp(mktime()), rtBefore);
> 21  }
> 22  catch(Exception $e){
> 23   print("\nException Versuch 2 ".$e->getMessage()." TraceString: 
> ".$e->getTraceAsString());
> 24  }
> 25
> 26 $server->Close();
> 27 ?>
>
> Line 12/20: The function ArcValue is designed for calling archived values 
> from a pi-point. It needs two values.
> First the date/time as Long, Int, String..., nearly each format. The 
> second value is a constant. We loaded all
> of them in Line 9. We tested all types of variant for the first value, but 
> each time it throws the following exception:
>
> ---
> Test 1:
> Exception Test 1 Parameter 0: Typkonflikt.  //Type-Mismatch in the english 
> version
> TraceString: #0 C:\php_pi\pitest.php(12): 
> variant->ArcValue(Object(variant), 6)
> #1 {main}
> Test 2:
> Exception Test 2 Parameter 0: Typkonflikt.
> TraceString: #0 C:\php_pi\pitest.php(20): 
> variant->ArcValue(Object(variant), 6)
> #1 {main}
> ----
>
> We tested other functions from the sdk. But each time we tried we lose. 
> :-/ Fololowing an example written in
> VisualBasic that works fine:
>
> Imports pisdk
> Public Class Form1
>    Private Sub Form1_Click(ByVal sender As Object, ByVal e As 
> System.EventArgs) Handles Me.Click
>        Dim MySdk As New PISDK.PISDK
>        Dim pt As PIPoint
>        Dim v As PIValues
>        pt = MySdk.Servers.DefaultServer.PIPoints("sinusoid")
>        v = pt.Data.PlotValues("1-Jan-07", "*", 1000)
>        MsgBox(v.Count & " Elements")
>    End Sub
> End Class
>
> It receives all datarows for the point "sinusoid" since first Jan and 
> counts them. This example works with
> VisualBasic but it didn't work on php.
>
> Some programmers of OSI-Soft said that all functions takes objects as 
> parameter so the type-mismatch is a
> problem in php. Because of the working VB code I think they are right.
>
> Has anyone a hint for me or a likewise problem with an other 
> sdk/application?
>
> Regards
> Oliver

I've reported the problem as php-bug.
http://bugs.php.net/43521

-- 
Mit freundlichen Grüßen / Best Regards

Oliver Espeter 

--- End Message ---
--- Begin Message ---
I found a solution and figured I would share with the everyone.

I was able to switch my request method over to POST (instead of GET). I
am now doing testing to make sure that this will meet my needs, but so
far it seems to work well.

This function accepts the data to post and then returns the resulting
page. the response page does not have to be html, but I have only tested
with text. I don't know how data would work. Data to be posted should be
in name=value&name1=value1 format.

//###################################################################
// post_and_retrieve function
//###################################################################
function post_and_retrieve($host, $path, $data_to_send) {
        $errno = 0;
        $errstr = '';
        $conn_timeout = 30;
        $headers = '';
        $content = '';
        $flag = false;
        $lc = 0;
        $content_len = 0;
        
        $fp = fsockopen($host,80, $errno, $errstr, $conn_timeout);
        if (!$fp || $errno != 0 || $errstr != ''){
                return "FAIL errno: $errno, errstr: $errstr";
        }
        fputs($fp, "POST $path HTTP/1.1\n" );
        fputs($fp, "Host: $host\n" );
        fputs($fp, "Content-type: application/x-www-form-urlencoded
\n" );
        fputs($fp, "Content-length: ".strlen($data_to_send)."\n" );
        fputs($fp, "Connection: close\n\n" );
        fputs($fp, $data_to_send);
        // remote script will now process the post and return a result
        while (!feof($fp)) {
                $res = fgets($fp,8192); //read 8k/line from remote host
                if ($flag) {
                        if ($lc == 0) {
                                // first line contains the content
length in hex
                                $content_len = hexdec(trim ($res));
                        } else {
                                $content .= $res;
                        }
                        $lc++;
                } else {
                        $headers .= $res;
                        if (strlen(trim($res)) == 0) {
                        $flag = true;
                        }
                }

        }
        // trim our content to content_len
        $content = substr ($content, 0, $content_len);
        if ($headers === FALSE || strlen ($headers) < 1) {
                return "FAIL could not read response content: $content";
        }
        fclose($fp);
        //$return = array('headers' => $headers, 'content' => $content);
        $return = $content;
        return $return;
}

Thanks,
James



On Tue, 2007-12-04 at 14:14 -0500, James Crow wrote:
> Hello all,
> 
>   I am having some trouble figuring out how to pass data to a remote PHP
> script. 
> 
> Here is the scenario: 
> I have several Windows boxes running Apache 2 and PHP 4. PHP5 is not an
> option because of some Zend Encoded scripts that we purchased. I need to
> pass data from one script to a remote script. The local script has an
> array that is serialized. Then the serialized string is then double
> urlencoded. A single urlencode does not work correctly on PHP4/Win32.
> The serialized and urlencoded string is then passed in the request to a
> remote script: http://192.168.1.2?data=<serialized string>
> This process works fine for small amounts of data. If the URL is below a
> certain limit (maybe 1024 characters, have not yet found the exact size
> limit) this works fine. 
> 
> I now have a need to pass more data to the remote script. I have tried
> to do
> $temp = array ('lots of data...');
> $temp1 = serialize($temp);
> $temp2 = gzcompress($temp1); //compress our string first to save space
> $temp3 = urlencode($temp2);
> $data = urlencode($temp3);
> http://192.168.1.1/?data=$data
> 
> Sometimes this works and sometimes not. I have not yet been able to
> figure out why this sometimes fails.
> 
> Can anyone tell me why this works sometimes and others not? Or can
> someone suggest a better way of passing data to a remote script.
> 
> Thanks,
> James
> 

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

In my site all emails are going fine 3-4 days ago.but now not even a single 
mail is coming.hosting environment is Cpanel based...I m using mail() function 
of php for sending mails, what may be the problem, any body can help me in this 
case.

Thanks,
Vikas Batra




      5, 50, 500, 5000 - Store N number of mails in your inbox. Go to 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html

--- End Message ---

Reply via email to