php-general Digest 17 May 2004 00:28:06 -0000 Issue 2767

Topics (messages 186347 through 186368):

Re: PEAR::DB is great but is sooooo SLOW !
        186347 by: Aidan Lister
        186349 by: Martin Hjort Eriksen
        186350 by: Tim Van Wassenhove
        186355 by: Curt Zirzow

Re: Template Engine -> TinyButStrong
        186348 by: Skrol 29

weird problem with index page
        186351 by: loll
        186352 by: BAO RuiXian
        186356 by: loll

Need help integration whoiscart.net script with my hosting template!
        186353 by: J.H.J. Saat
        186354 by: AP&J-SAAT Internet Solutions

File_exists result cached over a session?
        186357 by: Steve Magruder - WebCommons.org
        186363 by: Marek Kilimajer

How to get class name in static function (PHP 4.2.3)
        186358 by: Torsten Roehr
        186360 by: Curt Zirzow

Re: PHP and qmail
        186359 by: Justin Patrin

loosing memory
        186361 by: Merlin
        186364 by: Curt Zirzow
        186365 by: Merlin

Re: Reposting elseif carry
        186362 by: Curt Zirzow

session
        186366 by: MrS

Local_value Extension_Dir
        186367 by: Alexander Hachmann

while inside a while or join or...
        186368 by: T. H. Grejc

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 ---
There are many, many benchmarks done comparing PEAR::DB to PEAR::MDB to
AdoDB, PEAR::DB is much slower than the native API, AdoDB is the fastest but
least functional - I suggest you try PEAR::MDB2

http://pear.php.net/package/mdb2

once you get into it, you'll love it


"Rainer müller" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Greg wrote:
> > Hello,
> >
> > I've just performed a few tests when using PEAR::DB and
> > the results weren't good at all.
> >
> > If I compare a script using PEAR::DB with a script using
> > standard functions (and which supports mysql, pgsql and
> > sqlite databases), the script using PEAR::DB is 10 times
> > slower than the other.
> >
> > In one of my projects, it slows down execution time to
> > 0,7 sec per page !
> >
> > Conclusion : if you want to use PEAR::DB package, you'll
> > probably will have to use cache systems for scripts that
> > may be request often.
> >
> > Am I the only one annoying by this loss of performance ?
> > Because this is a huge loss in that case !
> >
> > Greg
>
> Remember, PEAR::DB also uses the standard functions, so I can't
> understand, why it should be much slower.
>
> Rainer

--- End Message ---
--- Begin Message ---
Remember, PEAR::DB also uses the standard functions, so I can't understand, why it should be much slower.

Rainer


You have to remeber that PEAR::DB is an object oriented abstraction over the standard functions, and within this abstraction, there is also built som error handling funtions, etc. in.

/Martin Eriksen
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, Greg wrote:
> If I compare a script using PEAR::DB with a script using
> standard functions (and which supports mysql, pgsql and
> sqlite databases), the script using PEAR::DB is 10 times
> slower than the other.
> 
> Conclusion : if you want to use PEAR::DB package, you'll
> probably will have to use cache systems for scripts that
> may be request often.

I don't understand your logic. 

Imho, you can only compare:
- A without caching VS B without caching
- A with caching VS B with caching

> Am I the only one annoying by this loss of performance ?
> Because this is a huge loss in that case !

I understand there might be a significant difference in performance, and
i understand nobody likes that.

But imho the real questions are these:
- What are the advantages of a Database Abstraction API?
- What are the disadvantages of a Database Abstraction API?
- Can we live with the lesser performance if we know we'll safe a lot of time
when we switch to another DBMS product? 
- How likely is it that we are going to switch to another DBMS? 

-- 
http://home.mysth.be/~timvw

--- End Message ---
--- Begin Message ---
* Thus wrote Tim Van Wassenhove ([EMAIL PROTECTED]):
> In article <[EMAIL PROTECTED]>, Greg wrote:
> 
> > Am I the only one annoying by this loss of performance ?
> > Because this is a huge loss in that case !
> 
> I understand there might be a significant difference in performance, and
> i understand nobody likes that.
> 
> But imho the real questions are these:
> - What are the advantages of a Database Abstraction API?
> - What are the disadvantages of a Database Abstraction API?
> - Can we live with the lesser performance if we know we'll safe a lot of time
> when we switch to another DBMS product? 
> - How likely is it that we are going to switch to another DBMS? 

And one that many people over look...

How portable are your SQL statments?


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

Sorry if my reply looks like an advertisement, but TinyButStrong is a mature
PHP Template Engine simple and which offers lot of features. It's
only 1 file (= easy to install), 1 class with 8 methods and 2 properties.

TinyButStrong's tags can be 100% designed into the template using WYSIWYG
editors. That's the only Template Engine doing that that I know.

Download, manual, examples, forum :
  http://www.tinybutstrong.com

-------------------
Skrol 29
www.skrol29.com
www.tinybutstrong.com
-------------------

"George Lantz" <[EMAIL PROTECTED]> a écrit dans le message de
news:[EMAIL PROTECTED]
> I was just wondering if anyone had any good advice or tutorials on
> building a simple template engine system. I am woking on a small project
> that I would like to distribute, and I would of course like to separate
> logic from html. I really just want to know the basics without caching.
> I am familiar with Smarty and PHPLib and FastTemplate and some others.
> But since I am going to be distributing the app, I would like it as
> portable and small/simple as possible. Those template systems are
> overkill for what I need. Really it does not even have to be a "Template
> system", I would just like to here your thoughts on how you may have
> accomplished separation of logic from output in a simple way.
>
> Thanks,
> George
>

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

I am not sure if this is a PHP or Apache problem, but I am hoping someone can tellme what is wrong.

When I go to www.domain.com on my server it shows the page as text instead of parsing the php code.

If I go to www.domain.com/index.php (same page) it runs as it should.

if I go to www.domain.com/subdir it sya s page not found even though there is a index.php file in that directory. I am at a loss as to what is wrong. index.php is listed inthe directoryindex for apache so I dont understand why it is doing all this.

If anyone can help me it would be appreciated.

Thanks

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


loll wrote:

Hi,

I am not sure if this is a PHP or Apache problem, but I am hoping someone can tellme what is wrong.

When I go to www.domain.com on my server it shows the page as text instead of parsing the php code.

If I go to www.domain.com/index.php (same page) it runs as it should.

if I go to www.domain.com/subdir it sya s page not found even though there is a index.php file in that directory. I am at a loss as to what is wrong. index.php is listed inthe directoryindex for apache so I dont understand why it is doing all this.


Interesting. Do you use virtual hosts? How many DirectoryIndex directives in your configuration file? What are their contexts? Got any error in your log file?

Best

Bao


If anyone can help me it would be appreciated.

Thanks

Loll


--- End Message ---
--- Begin Message ---
Well,

I managed to part fix the problem, now I have a problem where there is a page that all it does is redirect to another page, it wont redirect unless I hit the refresh button.

When I go to index.php it redirects to login.php, this is an old page that I just added a header("Location: blah); to so it would go to the new page. now it seems to jsut show a blank page instead of doing the second redirect, if I hit refresh on the blank page it will redirect correctly.

I wondered if there was some restriction somewhere on only allowing 1 redirect where this page needs to be able to do more than one? is htis something that would be in the httpd.conf or php.ini file?

Thanks!

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

I really need some help I did buy the whoiscart.net billing 
management system and already got a site design and I am trying 
to integrate the script with my Design for almost 2 weeks now.
And somehow its not working! I hope someone here can help me out, 
My site is a low budget hosting you can view it
 here: http://www.roda2020.com (its not working still) PLS help! 

I am willing to pay (I not got much money) for anyone that can 
help me out here. 

Greetings |Dexter| AKA Jack

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

I really need some help I did buy the whoiscart.net billing 
management system and already got a site design and I am trying 
to integrate the script with my Design for almost 2 weeks now.
And somehow its not working! I hope someone here can help me out, 
My site is a low budget hosting you can view it
 here: http://www.roda2020.com (its not working still) PLS help! 

I am willing to pay (I not got much money) for anyone that can 
help me out here. 

Greetings |Dexter| AKA Jack

--- End Message ---
--- Begin Message ---
File_exists results (and the results from other file-related functions) are
cached (according to the php doc) during the run of a script.  For instance,
if file_exists returns True for a file once, it won't actually test the file
again if file_exists is run again against the file.

What I need to know is whether this caching works over a session (not just
during a single script run).

Thanks.
-- 

Steve Magruder
www.webcommons.org

--- End Message ---
--- Begin Message --- Steve Magruder - WebCommons.org wrote:
File_exists results (and the results from other file-related functions) are
cached (according to the php doc) during the run of a script.  For instance,
if file_exists returns True for a file once, it won't actually test the file
again if file_exists is run again against the file.

What I need to know is whether this caching works over a session (not just
during a single script run).

Thanks.

no

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

does anyone know a way of how to get the name of the class within a static
function? I can't use __CLASS__ as my PHP version is 4.2.3 and I can't
upgrade.

My code (simplified):

class Base {
    function Factory() {
        $classname = ???;
        return new $classname;
    }
}

class Event extends Base {
}

// This should make $event an object of class Event
$event = Event::Factory();

Of course I could pass the classname as a parameter to the factory method
like:
$event = Event::Factory('Event');

But I would like to have a more generic solution. Any hints would be greatly
appreciated. Thanks in advance!

Regards, Torsten Roehr

--- End Message ---
--- Begin Message ---
* Thus wrote Torsten Roehr ([EMAIL PROTECTED]):
> Hi,
> 
> does anyone know a way of how to get the name of the class within a static
> function? I can't use __CLASS__ as my PHP version is 4.2.3 and I can't
> upgrade.
> 
> My code (simplified):
> 
> class Base {
>     function Factory() {
>         $classname = ???;
>         return new $classname;
>     }
> }
> 
> class Event extends Base {
> }
> 
> // This should make $event an object of class Event
> $event = Event::Factory();
> 
> Of course I could pass the classname as a parameter to the factory method
> like:
> $event = Event::Factory('Event');
> 
> But I would like to have a more generic solution. Any hints would be greatly
> appreciated. Thanks in advance!

The only Solution I can come up with:

class Event extends Base {
  function Factory() {
    return parent::Factory('Event');
  }
}

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
Manuel Lemos wrote:

Hello,

On 05/15/2004 04:14 PM, Stephen Lake wrote:

Can someone tell me how I can send HTML using qmail from a Script? The MTA I
was using was changed from Sendmail to qmail and now my HTML mails actually
show the html tags in the mail body.


That looks like a bug in the mail() function because qmail comes with sendmail compatible wrapper.

Anyway, you may want to try this class for composing and sending messages including HTML formatted. It comes with a sub-class specialized in qmail but I suspected that you do not need to use it as the base class that uses mail() already comes with workarounds to use the mail()
function without the problems you are facing:


http://www.phpclasses.org/mimemessage



.....Why do you always say that this is a bug? I've sent many a HTML e-mail using PHP's mail() function just fine with multiple MTAs. It just requires careful setting up of the message.


--
paperCrane <Justin Patrin>

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

I am running the newest php 4.x branch on a suse 9.0 apache 1.3x system
Hardware: 1G ram

It apears to me that the system anyhow has a memory leak. While running "top" on linux it shows the free memory declining steadily. After about 48h the system starts to swap. Restarting apache gracefully brings it back to about 140 MB free ram, thats all.

Is there a way to show all memory in use and therefore make it easy to identify the problem? I realised that some scripts have missed the imagedestroy function, but after I added this, the system still eats the memory.

Thank you for any hint on that.

Merlin
--- End Message ---
--- Begin Message ---
* Thus wrote Merlin ([EMAIL PROTECTED]):
> Hi there,
> 
> I am running the newest php 4.x branch on a suse 9.0 apache 1.3x system
> Hardware: 1G ram
> 
> It apears to me that the system anyhow has a memory leak. While running 
> "top" on linux it shows the free memory declining steadily. After about 48h 
> the system starts to swap. Restarting apache gracefully brings it back to 
> about 140 MB free ram, thats all.

While your tracking this down you can change your
'MaxRequestsPerChild' setting in apache.


> 
> Is there a way to show all memory in use and therefore make it easy to 
> identify the problem? I realised that some scripts have missed the 
> imagedestroy function, but after I added this, the system still eats the 
> memory.

php should release any memory allocated in the scripts, except for
a some 3rd party extension's or if you're using shared memory with
in your scripts.

You can ./configure --enable-debug with php and it will detect
memory leaks, php will issue an E_WARNING if a memory detection
occurs. if this is a production server, make sure that php is
loggin to syslog and display_errors = off.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
thank you. I will try that.

Merlin

Curt Zirzow wrote:

* Thus wrote Merlin ([EMAIL PROTECTED]):

Hi there,

I am running the newest php 4.x branch on a suse 9.0 apache 1.3x system
Hardware: 1G ram

It apears to me that the system anyhow has a memory leak. While running "top" on linux it shows the free memory declining steadily. After about 48h the system starts to swap. Restarting apache gracefully brings it back to about 140 MB free ram, thats all.


While your tracking this down you can change your
'MaxRequestsPerChild' setting in apache.



Is there a way to show all memory in use and therefore make it easy to identify the problem? I realised that some scripts have missed the imagedestroy function, but after I added this, the system still eats the memory.


php should release any memory allocated in the scripts, except for
a some 3rd party extension's or if you're using shared memory with
in your scripts.

You can ./configure --enable-debug with php and it will detect
memory leaks, php will issue an E_WARNING if a memory detection
occurs. if this is a production server, make sure that php is
loggin to syslog and display_errors = off.


Curt

--- End Message ---
--- Begin Message ---
* Thus wrote Ronald The Newbie Allen ([EMAIL PROTECTED]):
> While I am sure that you are right.  I went to the webpages that you
> identified and did not see anything on' and ".  I tried the code that typed
> up and it said that Date_and_Time wher and undefinded index and also that
> the headers could not be modified.

http://www.php.net/manual/en/language.types.string.php

As noted in that document:

$var = 'a value';
$array['key'] = 'has this value';

echo "var is $var, and array {$array['key']}";

output:
  var is a value, and array has this value


echo 'var is $var, and array {$array[\'key\']}';

output:
  var is $var, and array {$array['key']}


The undefined index is because $_POST['Date_and_Time'] is not set,
you're probably using the form method GET so it will be defined in
$_GET instead, for more info on this see:

 http://www.php.net/manual/en/language.variables.external.php


The headers couldn't be modified becase php sent the notice of
undefined index to the browser, stop that notice and the header()
redirect will work properly.

> 
> the base_url is this suppose to be an I or and L
> $base_url .= dirname($_SERVER['REQUEST_UR    I   ']);

it is 'I' as in Identifier.

URL: http://servername/path/to/file
URI: /path/to/file


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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

How can I check if speciffic session is alive having session id?
Or how can I delete data from MySQL belong to dead session?

(I hope somebody understend what I wrote)

MrS

--- End Message ---
--- Begin Message ---
Hello,
I have the problem, that Modules located in the directory which ist set as
the local_value, do not work.
The normal Directory for Example is /usr/share/extension.
Now I set in the Virtualhost settings the Directory to
/usr/share/extension/user.
You can see in the php_info(); that the new Directory has been taken, but
the Modules located in this directory do not work.
What do I make wrong. When the Module is in the System-ExtensionDir
/usr/share/extension it works.
Can somebody help me??
Thx,
    A.Hachmann

--- End Message ---
--- Begin Message ---
Hallo,

I know of a few ways of doing this but I am not sure that any is right. I want to consult with you what is the best way of doing this:

Table 1:
+----+-----+
| *a* | *b* |
+----+-----+
|  2   |  1    |
+----+-----+
|  2   |  2    |
+----+-----+

Table 2:
+----+-----+
| *b* | *d* |
+----+-----+
|  1   |  asd |
+----+-----+
|  2   |  fgh |
+----+-----+

I would like to select all 'b' from Table_1 WHERE a = '2' and then to select all 'd' from table_2 with 'b' from previous result.

Table 2 is the Table with UserNames (d) and Table 1 is the table with 'marked' UserID's (b).

What is the best way of doing this.

TNX
--- End Message ---

Reply via email to