Re: [SMARTY] Using RDBMS for Smarty

From: Date: Sat, 22 Feb 2003 16:51:27 +0000
Subject: Re: [SMARTY] Using RDBMS for Smarty
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8121@lists.php.net to get a copy of this message
Monte Ohrt <monte@ispi.net> wrote: > If you pull PHP code from a database you would have to eval() it which > is significantly slower than including off a file system, not to mention > the SQL query overhead. You're much better off figuring out how to write > out files IMHO. Points well taken. I've been working on subclassing Smarty_Compiler to make it generate eval() friendly code since eval will only work with pure PHP. I'm also figuring out how to write out files using a generic interface, similar to being able to read resources from different sources. That's an integral part of the mod anyway. > > as far as i know nobody is working on such a modification. > > > > i think the main point is, that a lot of the people using smarty do > > also use phpa (http://www.php-accelerator.co.uk/) . phpa caches the > > parsed php-code and can speed-up execution (read "display") of > > templates tremendously. i think if you don't store your php-code in > > the file-system, phpa is not (or cannot be) smart enough to cache the > > parsed code. that would limit the usefulness of a > > "$smarty->compiled_tpl_handler_func" significantly. I am not familiar with php-accelerator since most sites I've worked on do not use it. Thanks for the tip though. The motivation behind such a modification is to make it easy for sites that use some sort of CMS that does not allow one to write to the filesystem directly. Instead, when you upload a file, it would be written into a database. Such setups also mean that you are not allowed to make direct writes to the filesystem through a program running as an unprivileged user. This is the whole point of running the webserver as an unprivileged user in the first place. > > for your "sensible operator" i can say, that on a lot of setups it is > > far easier to emit (nearly) arbitrary data into the underlying > > database, than to illegally manipulate local files. so you wouldn't > > gain that much security be disallowing templates_c. I agree with you there. But haggling with the operator to allow nobody, www, or apache to write files to the filesystem can be an exercise in self-restraint at best. Because of my peace-loving nature, I am honor bound to find a way around BOFH's :) And because I would rather spend my time writing code that works than doing social engineering. Best regards, -- _nimrod_a_abing_ PGP Public Key here: http://www.redberger.com/~abing/abing_at_redberger_dot_com.asc Key expires 2003-11-06

« previous php.smarty.general (#8121) next »