[PHP] Re: eval()

2002-01-20 Thread Michael Waples

Kunal Jhunjhunwala wrote:
> 
> Hey
> Does anybody know if its wise to use eval() ? I know Vbulletin uses it.. but
> there is something about it I just cant digest.. it seems to be a very
> powerfull function which can be very easily exploited... anyone else have
> any thoughts?
> Regards,
> Kunal

 Loading your templates into a database, pulling them out on every page
load and running eval() to run the code isn't the most efficient way to
do it.
Then running eval() inside a loop on that code isn't efficient either.

I think eval() is used this way by some people because they don't know
how to write files using php propely. So instead they just put it in a
database. You also completely miss out on getting the benefits of one of
the different php caching products.
For me a database is for storing data - not php code.
Vbulletin as an example of complete overuse of eval().

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: eval()

2002-01-20 Thread Michael Waples

Kunal Jhunjhunwala wrote:
> 
> Hey,
> I tend to agree with you. But what is the most effiecent way of using php
> code in template files then? I am not going to move my templates to a
> dbase.. thats for sure.
> Regards,
> Kunal Jhunjhunwala

well for looping through the results of a sql query where you'd want to
print out some html -
to do that you could -
a include a file inside a loop
b run eval on some code from a database
c run a function

I find c to be the most efficient
eg

function thread($sql_arra0
{
echo 'name - '. $sql_array['name'] .';
}

then inside of loop

thread($sql_array);

works a lot quicker than the other two methods.

I don't see how you can avoid putting php code in templates because you
need to put $var in there some way so you can print out the variable. So
if it's in a database it needs some eval() done on it.
I really can't see the point in querying a database to pull out template
data. Templates usually don't change very often at all and querying a
database to pull out unchanged template data is waste of cpu and memory
resources.


 
> 
> > Kunal Jhunjhunwala wrote:
> > >
> > > Hey
> > > Does anybody know if its wise to use eval() ? I know Vbulletin uses it..
> but
> > > there is something about it I just cant digest.. it seems to be a very
> > > powerfull function which can be very easily exploited... anyone else
> have
> > > any thoughts?
> > > Regards,
> > > Kunal
> >
> >  Loading your templates into a database, pulling them out on every page
> > load and running eval() to run the code isn't the most efficient way to
> > do it.
> > Then running eval() inside a loop on that code isn't efficient either.
> >
> > I think eval() is used this way by some people because they don't know
> > how to write files using php propely. So instead they just put it in a
> > database. You also completely miss out on getting the benefits of one of
> > the different php caching products.
> > For me a database is for storing data - not php code.
> > Vbulletin as an example of complete overuse of eval().
> >
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: What if 1,000 people access the database at one time?

2002-01-25 Thread Michael Waples

Phil Schwarzmann wrote:
> 
> So let's say Bill is accessing a MySQL table and is about to UPDATE some
> information on a particular row.  Meanwhile, Al is doing a sort on that
> same table.
> 
> Couldn't Al's sorting possibly screw up Bill's updating??  Or does
> MySQL have some built in functions that prevent this?
> 
> Thanks!
> Phil

This is really better suited to the mysql list but anyway -
In your case If Al started the sort first the update would wait until
the select is finished for the update.
MYsql has this wonderful feature called table locking - so an update
needs to lock the table preventing access to it.
So your data wont get stuffed, you'll just get the typical MYsql
slowness when you've got a lot of updating and reading going on.

You need not suffer this get a database that doesn't block readers (eg
Al wanting to read the table while bill updates it) use something 
like Postgresql (postgresql.org) or Fierbird (firebirdsql.org) both are
free.

Or you could use INNodb tables in MYsql as they don't block readers
either. But MYsql is missing a lot of basic stuff like sub selects so if
you have a choice dump MYsql.
MYsql is not noted for its performance with a lot of concurrent
connections.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: What if 1,000 people access the database at one time?

2002-01-25 Thread Michael Waples

Michael Waples wrote:
> 
> Phil Schwarzmann wrote:
> >
> > So let's say Bill is accessing a MySQL table and is about to UPDATE some
> > information on a particular row.  Meanwhile, Al is doing a sort on that
> > same table.
> >
> > Couldn't Al's sorting possibly screw up Bill's updating??  Or does
> > MySQL have some built in functions that prevent this?
> >
> > Thanks!
> > Phil
snip wrong reply
> 
ah I guess you don't mean a select but table maintenance stuff.
Should have read it more carefully.
Still you'll be safe

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Mysql / PostgreSQL with PHP

2002-01-28 Thread Michael Waples

[EMAIL PROTECTED] wrote:
> 
> Hi everybody
> 
> I'm not sure it is the best place for my question.
> 
> Until now we were using PHP connecting to an oracle database. We are
> looking to change for an opensource database for the new applications.
> 
> Do you know where I can find a recent and objective study comparing both
> with PHP to connect to it.
> 
> Thanks and exceuse me if it is not the right forum to ask it
> 
> Laurent Drouet

http://www.ca.postgresql.org/~petere/comparison.html  is well worth a
read
and since MYsql has no triggers, stored procedures, views or subselects
you will miss a lot of what you are used to.
Postgresql has all those and you will find pl/pgsql quite easy to use as
its similar to Oracles plsql.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Server Loading Question...

2002-02-07 Thread Michael Waples

"Jason G." wrote:
> 
> Hello List,
> 
> Does anyone know of a Really Good way to determine what kind of loads your
> Webserver/network can handle before degrading performance or flaking
> out?  I would like to find this out about our server before it fails us
> under heavy load.
> 
> Thanks,
> 
> Jason Garber
> Univo.biz

I prefer httperf over Apaches ab -
http://freshmeat.net/projects/httperf

It's more flexible than ab.

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