On Thu, Mar 13, 2008 at 10:18 AM, Chris Chabot <[EMAIL PROTECTED]> wrote:
> Basicly (in semi-pseudo code) it would mean doing something like:
>
> $out = tempnam('/tmp','compressout');
> if (!$config['debug']) {
> if (we can't retrieve the cached compressed version) {
> @exec("java -jar {$path_to}/yuicompressor-2.2.5.jar -o $out
> --type js
> $feature_js_file");
> if (($contents = file_get_contents($out))) {
> // store in cache so we don't have to keep compressing
> each
> request
> }
> }
> }
Is exec as expensive in PHP as it is in most other web programming
frameworks? In general calling exec() in the context of a web server
is a bad idea. It usually leads to both performance and security
problems. Caching the output will reduce the problem a bit, but in
general this seems like a suspicious coding practice.