Re: [PHP] templating engine options

2009-05-26 Thread Sancar Saran
On Tuesday 26 May 2009 03:48:41 am Nathan Rixham wrote:
> Sancar Saran wrote:
> >  > $content = 'No Comments';
> > if(isset($comments) and is_array($comments) and count($comments) > 0 ) {
> > $content = '';
> > foreach( $comments as $index => $comment ) : $content. = "".$comment->title.""; endforeach;
> > }
> > ?>
> >
> > Comments
> > 
> > 
> > 
> >
> > index.php
> > ob_start();
> > require('template.php');
> > echo ob_get_clean();
> >
> >
> > I'm still do not understand for complex template system requirement.
>
> I just _need_ the two abstracted.
>
> php must have no html in it
> html template must contain no php
>
> > Why it have to be very complex system.
> >
> > Large data array, some conditions, lots of loops, and What else ?
> >
> > http://www.flytag.de/
> > http://urlaub-finder.de/
> > http://airportdirekt.de/
> >
> > All same system. With different css designs.
>
> yup, did this myself for a long time; here is some very old code I
> used to use!
>
> newCage();
> $content = cage(include $file);
>
> function newCage() {
>   ob_start();
> }
> function cage() {
>   $includeOutput = ob_get_contents();
>   ob_end_clean();
>   return $includeOutput;
> }
>
> lol
Alright, my vote going to smarty.

After compilation, it running on native php.

And

When we use TYPO3 native marker model (which fits your requirement, no php in 
template) I found very dull. Load template to memory, fetch part of template, 
generate loop for processing template, feed template keys in the loop. 

After some time %75 of code become template feed. Like this

//--- Get Template
$this->templateFileContent = $this->cObj-
>fileResource('fileadmin/templates/travelit_booking.html');
$strCarLoop= $this->cObj->getSubpart($this-
>templateFileContent,"###CAR_LOOP###");
$strPLoop  = $this->cObj->getSubpart($this-
>templateFileContent,"###PASSANGER_LOOP###");
$strCarTable   = $this->cObj->getSubpart($this-
>templateFileContent,"###CAR_TABLE###");
$strHotelBooking   = $this->cObj->getSubpart($this-
>templateFileContent,"###HOTEL_BOOKING###");
$strFlightBooking  = $this->cObj->getSubpart($this-
>templateFileContent,"###FLIGHT_BOOKING###");



if(isset($arrData['MW']) && is_array($arrData['MW']['MWLIST']['CAR']))
{
$intCarSize = sizeof($arrData['MW']['MWLIST']['CAR']);
for($intX=0;$intX < $intCarSize;$intX++)
{
$arrSubst = '';
$arrSubst['###CAR_OPTION_VALUE###'] = 
$arrData['MW']['MWLIST']['CAR'][$intX]
["@"]['GROUP']."-".$arrData['MW']['MWLIST']['CAR'][$intX]["@"]['ID1']."-".
$arrData['MW']['MWLIST']['CAR'][$intX]["@"]['ID2']."-".$arrData['MW']
['MWLIST']['CAR'][$intX]["@"]['NAME']."-".$arrData['MW']['MWLIST']['CAR']
[$intX]["@"]['PRICE'];
$arrSubst['###CAR_OPTION_PRICE###'] = 
number_format($arrData['MW']['MWLIST']
['CAR'][$intX]["@"]['PRICE'], 0, ',', '.');
$arrSubst['###CAR_OPTION_NAME###']  = 
$arrData['MW']['MWLIST']['CAR'][$intX]
["@"]['NAME'];
$strCarss.= 
$this->cObj->substituteMarkerArrayCached($strCarLoop,$arrSubst);
}
}


 ###CAR_OPTION_PRICE € ###CAR_OPTION_NAME###





###BOOKING_RENT_A_CAR_LABEL###





###BOOKING_RENT_A_CAR_INFO###



###BOOKING_CAR_INFO_LABEL###



###BOOKING_I_DONT_WANT_TO_RENT_A_CAR###

###BOOKING_RENT_A_CAR_LOOP###





Then I realize, doing some coding for data which I already have make me sick. 
and When you go with multi language site you will realize, every tiny bit of 
template have to template marker keys. And you have to do this mule job

And begin to use this.



 
 

 
 







get_rentacar($this->php_response['MW']['MWLIST']['CAR'])?>
 




(both of them doing same thing, second one had extended js.)

And no html in PHP was your code ability.  I had %5 percent html in my php 
code because making them separate file was unnecessary (to me) and all of them 
non themeable man

RE: [PHP] templating engine options

2009-05-26 Thread Andrea Giammarchi

Finally somebody mentioned XSL Transformations. Time is relative because as you 
need time to learn an API to produce quickly only after a while, thanks to 
knowledge and confidence, XSL is the same with the advantage that you transform 
a data structure, rather than work over raw programming language ( portability 
and re-usability )

I wrote a post in my blog about this long thread, hope you'll get some point:
http://webreflection.blogspot.com/2009/05/template-engine-why-bother-xml-xslt.html

Best Regards


> Date: Mon, 25 May 2009 23:44:43 +0100
> From: nrix...@gmail.com
> To: stut...@gmail.com
> CC: rob...@interjinn.com; linuxmanmi...@gmail.com; tedd.sperl...@gmail.com; 
> php-general@lists.php.net
> Subject: Re: [PHP] templating engine options
> 
> Stuart wrote:
> > 2009/5/25 Robert Cummings :
> >> I continued the discussion with Nathan.
> > 
> > I too have had an off-list discussion with Nathan on this topic, and a
> > productive one at that.
> > 
> 
> which would probably be a good time for me to step back in; having had a 
>   nice little inside in to both Robert and Stuarts template systems, and 
> indeed way(s) of doing things. Also thanks to everybody else who made 
> suggestions and gave input - it was all appreciated.
> 
> I'm far from making a final decision, as I've decided to approach this 
> by setting a few guidelines and a wishlist, then either finding / 
> modifying something to do the job, or creating something from scratch.
> 
> Both Rob and Stuarts systems were more in common than they may think, 
> focus in both was on performance, and only making set data available to 
> the templates (whether pushing or pulling).
> 
> The syntax did differ though, and functionality aside this is probably 
> one of the most important aspects (imho).
> 
> Markup & XML sits well with me (and most) because we are web developers 
> and use it daily.
> 
> PHP syntax also sits well because we also use it daily.
> 
> The fact remains though that this "feels like" (and possibly is) a 
> different job which requires something different. Both XHTML and PHP do 
> their job well - just as ecma(java)script and css do theirs.
> 
> However none of these technologies / languages are suited and dedicated 
> to converting provided data in to specified output; specifically, and 
> only, xhtml.
> 
> XSL Templates are near perfect, built for the job, and very powerful - 
> but time hasn't favoured them well; and until (if ever) a wide spread 
> adoption happens something else needs to fill the gap.
> 
> Template Specific Thoughts:
> 
> Smarty, Stuarts Engine, Robs Engine, PHPLIB and many more had one common 
> theme, they all limited the data available. My terminology of limited 
> perhaps sounds wrong, so maybe "make specified selected data available" 
> or "provide access to the view" will make more sense. Inline with 
> layered and tiered application design this makes perfect sense; thus..
> 
> A template /should/ only be able to access the data made available to 
> it, nothing else. Whether it requests the data or the data is provided 
> is covered later. If it doesn't have all the data needed then this needs 
> reviewed and the application needs changed to provide it. Not the 
> template engine bastardized to accommodate a limited app.
> 
> A template ~should~ have unique yet easy to understand syntax, something 
> that complements xhtml and provides all needed functionality. (IMHO it 
> should not be php syntax)
> 
> A template engine must stick within it's role boundaries, it's not a 
> cache engine, its not php, its not xhtml, its not for implementing 
> functionality - it is simply and purely to do its job - take data, 
> populate an xhtml template with it and return the result - nothing more, 
> nothing less.
> 
> 
> Push vs Pull.
> 
> This is a much bigger issue than I thought, and perhaps is the crux of 
> the whole thing. I can see two clear approaches;
> 
> Firstly, (the common one)
> - app passes data and a template to the template engine
> - template engine merges it together and passes back
> - app does as it pleases with data (sends it to client, caches it, fires 
> it in an email - whatever)
> 
> Secondly, (uncomment)
> [think modular]
> - app provides an api / gateway to views of data
> - template engine requests view(s) specified in template from app
> - template engine populates template modules with data & sends output to
> 
> I guess the first is template engine as a Util / Service - and the 
> second is template engine as a Layer / App.
> 
> There are pros and cons in each design, concentrating on the second 
> design for now - this brings in a lot of scope which seems to fit well 
> both practically and architecturally.
> 
> The freedom to be able to specify in template that...
> 
> this is template module "latest posts", it is bound to the data view (or 
> data provider) "latest posts(8)"
> whilst overall combining template (page) is comprised of modules x,y and 
> z - here, here and here.
>

[PHP] Background Process

2009-05-26 Thread shahrzad khorrami
Hi,
I have two php scripts, first one must pass arguments to second(the php
script that will take more time to process for example inserting 100
records to db, data come from first script). I search around web and find
below function:



function execInBackground($path, $exe, $additional) {
global $conf;

if (file_exists($path . $exe)) {
chdir($path);
if (substr(php_uname(), 0, 7) == "Windows"){
echo 'going Windows';
pclose(popen("start \"bla\" \"" . $exe . "\" "  . $additional,
"r"));   } else {
exec("./" . $exe . " " .  $additional . " > /dev/null
&");   }
}
}

But I don't know how to pass variables to the second file? and how to use of
this function?
in *windows* enviroment... and return value of second file to first..

Thanks in advance
shahrzad


Re: [PHP] templating engine options

2009-05-26 Thread Nathan Rixham

Andrea Giammarchi wrote:

Finally somebody mentioned XSL Transformations. Time is relative because as you 
need time to learn an API to produce quickly only after a while, thanks to 
knowledge and confidence, XSL is the same with the advantage that you transform 
a data structure, rather than work over raw programming language ( portability 
and re-usability )

I wrote a post in my blog about this long thread, hope you'll get some point:
http://webreflection.blogspot.com/2009/05/template-engine-why-bother-xml-xslt.html

Best Regards



nice post, and nice choice!

love xsl, nothing else comes close and if more of my fellow developers 
and designers used xsl I wouldn't be asking about template engines.


IMHO I can't see any reason why _every_ developer (and app) doesn't use xsl.

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



[PHP] Re: Background Process

2009-05-26 Thread Nathan Rixham

shahrzad khorrami wrote:

Hi,
I have two php scripts, first one must pass arguments to second(the php
script that will take more time to process for example inserting 100
records to db, data come from first script). I search around web and find
below function:



function execInBackground($path, $exe, $additional) {
global $conf;

if (file_exists($path . $exe)) {
chdir($path);
if (substr(php_uname(), 0, 7) == "Windows"){
echo 'going Windows';
pclose(popen("start \"bla\" \"" . $exe . "\" "  . $additional,
"r"));   } else {
exec("./" . $exe . " " .  $additional . " > /dev/null
&");   }
}
}

But I don't know how to pass variables to the second file? and how to use of
this function?
in *windows* enviroment... and return value of second file to first..

Thanks in advance
shahrzad



after following your recent threads, can I ask have you considered using 
the tools made available by the db? something like


LOAD DATA LOCAL INFILE '/importfile.csv'
INTO TABLE test_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(field1, filed2, field3);

this will be 100x faster than anything you can write with php

regards!

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



Re: [PHP] Re: Background Process

2009-05-26 Thread kranthi
popen will allow you to read/write data to a file but not execute the php code.

i am assuming that you want to execute the php script like
include/require does.. if that is the case system() will serve your
purposebut this requires php to be installed as a CLI


but as Nathan suggested it would be best for you if you considered
alternative options. for example you can make an AJAX  request to the
second file.
Kranthi.

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



Re: [PHP] html and password management

2009-05-26 Thread kranthi
seems more of a firefox question than a PHP question...

just replace 
with 

https://developer.mozilla.org/en/How_to_Turn_Off_form_Autocompletion

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



RE: [PHP] IE can't download, FF can: SSL ? Need special headers?

2009-05-26 Thread Ford, Mike
On 22 May 2009 20:41, Dee Ayy advised:

> That's what I had in my first post.  What are the rest of
> your headers?
> 
> This is what is now deployed and I consider this issue resolved, but
> allowing spaces in the filename across IE, FF, and Safari browsers
> would be the real solution.

Haven't tried this, but does URL encoding spaces with %20 rather than +
help any? If so, you might want to consider using rawurlencode().

>  It's untested on other browsers:
> 
> header('Content-Description: File Transfer');
> header('Content-Type: '.$type);
> header('Content-Disposition: attachment;
> filename='.basename(str_replace(' ', '_', $name)));
> header('Content-Transfer-Encoding: binary');
> header('Expires: 0');
> header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
> header('Pragma: public'); header('Content-Length: '.$size);
> echo $data;

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: m.f...@leedsmet.ac.uk
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] templating engine options

2009-05-26 Thread tedd

At 12:46 PM -0400 5/25/09, Robert Cummings wrote:


I'm going to leave this discussion here since it's eating up too much of
my time :)

Cheers,
Rob.


Rob:

It's always been my experience to listen when you talk. -- so -- when 
you find some time AND have the inclination, could you prepare a 
simple example of what you are saying?


I know when I'm trying to explain a complex concept to someone I 
usually can reduce it down to the basics to demonstrate. As it is 
right now, I get some of what you are saying and then in the next 
line you lose me.


Thanks for your time.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] IE can't download, FF can: SSL ? Need special headers?

2009-05-26 Thread Dee Ayy
Ashley,
Don't scare me like that.  I know I'm losing my eye sight, but a
copy-paste-diff shows your
header("Content-Disposition: attachment; filename=\"$filename\"");
differs from my original post's
header("Content-Disposition: attachment; filename=\"$name\"");
by only the text "file".  This method (with the other headers I used
in my original post) fails on IE with the lame error:
Internet Explorer was not able to open this Internet site.  The
requested site is either unavailable or cannot be
found.  Please try again later.

Hence the reason for my post in the first place.  If you would show
your other headers for the \" quoted method, I'd be happy to test
them.  Maybe you were comparing your method to my single tick method?


Mike,
rawurlencode (sounded promising) but did in fact leave it saved on the
hard drive as %20 rather than + or the desired "space".  I find the
str_replace spaces to underscores more readable, although saving to
the hard drive with spaces would be best.  Thanks though.

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



Re: [PHP] templating engine options

2009-05-26 Thread tedd

At 8:13 PM +0100 5/25/09, Stuart wrote:

I too have had an off-list discussion with Nathan on this topic, and a
productive one at that.

-Stuart


Great! Now you guys are having a three-some without me. :-)

While I wasn't getting it, I was trying.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-26 Thread hessiess
Something that seriously annoys me about PHP is the fact that it has
a configuration file which can *completely* change the behaviour of
the language. Take the following for example:
--
function parse_to_variable($tplname, $array = array())
{
$fh = fopen($tplname, 'r');
$str = fread($fh, filesize($tplname));
fclose($fh);

extract($array);

ob_start();
eval($str);
$result = ob_get_contents();
ob_end_clean();
return $result;
}
--

Which would take a template file like this (DTD etc left out):
--
List:







--

The above code loads in the template file, eval()'s it and then saves the
result into a variable, so that it may be intergraed into anouther element
of a dynamic website, which is a hell of a lot cleaner than the:
--
echo ("" . $some_variable . "" ...);
--

mess that you find in a lot of PHP code. Not only is it hard to read, but it
also produces awfully indented HTML, unlike the template method which outputs
properly indented code and is much easier to read.

This works perfectly so long as output buffering is enabled, however for some
reason my web host has decided to disable output buffering in the config
file,
rendering the above elegant solution completely useless(*). So, why does PHP
have to have such a pain in the a$$ configuration file. It makes developing
platform and even install independent code a nightmare, I am seriously
considering
moving to a different language because of this.

(*) This could be implemented by saving the variables as XML, making a POST
request to another script, which would then convert the XML back into an
array, eval() the template and send the result back to the first script
`as if' it was sending to a browser. The first script would then capture
the result as a variable. While this would also work, it would be unnecessary
complicated and very slow in comparison, It is *still* dependent on the
settings
in the config file.


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



Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-26 Thread Robert Cummings
On Tue, 2009-05-26 at 18:30 +0100, hessi...@hessiess.com wrote:
> Something that seriously annoys me about PHP is the fact that it has
> a configuration file which can *completely* change the behaviour of
> the language. Take the following for example:
> --
> function parse_to_variable($tplname, $array = array())
> {
> $fh = fopen($tplname, 'r');
> $str = fread($fh, filesize($tplname));
> fclose($fh);
> 
> extract($array);
> 
> ob_start();
> eval($str);
> $result = ob_get_contents();
> ob_end_clean();
> return $result;
> }
> --
> 
> Which would take a template file like this (DTD etc left out):
> --
> List:
> 
> 
> 
> 
> 
> 
> 
> --
> 
> The above code loads in the template file, eval()'s it and then saves the
> result into a variable, so that it may be intergraed into anouther element
> of a dynamic website, which is a hell of a lot cleaner than the:
> --
> echo ("" . $some_variable . "" ...);
> --
> 
> mess that you find in a lot of PHP code. Not only is it hard to read, but it
> also produces awfully indented HTML, unlike the template method which outputs
> properly indented code and is much easier to read.
> 
> This works perfectly so long as output buffering is enabled, however for some
> reason my web host has decided to disable output buffering in the config
> file,
> rendering the above elegant solution completely useless(*). So, why does PHP
> have to have such a pain in the a$$ configuration file. It makes developing
> platform and even install independent code a nightmare, I am seriously
> considering
> moving to a different language because of this.

Could you tell us what configuration setting they have changed? I wasn't
aware you could prevent the use of output buffering. I guess maybe if
they set output_buffering = 1 to force flushing after a single byte.
Either way, this is not a PHP issue, this is a web host problem. The
blame lies squarely on their shoulders if they have changed how
something fairly standard works. Such settings are usually made
available to people who know what they're doing and who need specific
functionality.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-26 Thread Daniel Brown
On Tue, May 26, 2009 at 13:30,   wrote:
> Something that seriously annoys me about PHP is the fact that it has
> a configuration file which can *completely* change the behaviour of
> the language.

We are very, very sorry that we've created an extensible language
that pleases thousands upon thousands of users, but has disappointed
you.  If you would like to file a bug report or feature request for a
complete downgrade and stripping of functionality, please visit
http://bugs.php.net/.

Thank you for your interest in PHP.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/

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



Re: [PHP] Why does PHP have such a pain in the a$$ configurationfile?

2009-05-26 Thread Shawn McKenzie
Robert Cummings wrote:
> On Tue, 2009-05-26 at 18:30 +0100, hessi...@hessiess.com wrote:
>> Something that seriously annoys me about PHP is the fact that it has
>> a configuration file which can *completely* change the behaviour of
>> the language. Take the following for example:
>> --
>> function parse_to_variable($tplname, $array = array())
>> {
>> $fh = fopen($tplname, 'r');
>> $str = fread($fh, filesize($tplname));
>> fclose($fh);
>>
>> extract($array);
>>
>> ob_start();
>> eval($str);
>> $result = ob_get_contents();
>> ob_end_clean();
>> return $result;
>> }
>> --
>>
>> Which would take a template file like this (DTD etc left out):
>> --
>> List:
>> 
>> 
>>
>> 
>> 
>>
>> 
>> --
>>
>> The above code loads in the template file, eval()'s it and then saves the
>> result into a variable, so that it may be intergraed into anouther element
>> of a dynamic website, which is a hell of a lot cleaner than the:
>> --
>> echo ("" . $some_variable . "" ...);
>> --
>>
>> mess that you find in a lot of PHP code. Not only is it hard to read, but it
>> also produces awfully indented HTML, unlike the template method which outputs
>> properly indented code and is much easier to read.
>>
>> This works perfectly so long as output buffering is enabled, however for some
>> reason my web host has decided to disable output buffering in the config
>> file,
>> rendering the above elegant solution completely useless(*). So, why does PHP
>> have to have such a pain in the a$$ configuration file. It makes developing
>> platform and even install independent code a nightmare, I am seriously
>> considering
>> moving to a different language because of this.
> 
> Could you tell us what configuration setting they have changed? I wasn't
> aware you could prevent the use of output buffering. I guess maybe if
> they set output_buffering = 1 to force flushing after a single byte.
> Either way, this is not a PHP issue, this is a web host problem. The
> blame lies squarely on their shoulders if they have changed how
> something fairly standard works. Such settings are usually made
> available to people who know what they're doing and who need specific
> functionality.
> 
> Cheers,
> Rob.

In addition to what Rob said, the only other option would be
implicit_flush, which is ridiculous if it is set to on.

Maybe the file that you're evaling has some ob stuff or flush() in it?

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-26 Thread Andrew Ballard
On Tue, May 26, 2009 at 1:47 PM, Robert Cummings  wrote:
> [snip] Such settings are usually made
> available to people who know what they're doing and who need specific
> functionality.
>
> Cheers,
> Rob.

Not *quite* right. The problem is that such settings are made
available to everyone, even though they are intended for those
specific few who know what they're doing and who need specific
functionality.  :-)

Andrew

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



Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-26 Thread Robert Cummings
On Tue, 2009-05-26 at 14:10 -0400, Andrew Ballard wrote:
> On Tue, May 26, 2009 at 1:47 PM, Robert Cummings  wrote:
> > [snip] Such settings are usually made
> > available to people who know what they're doing and who need specific
> > functionality.
> >
> > Cheers,
> > Rob.
> 
> Not *quite* right. The problem is that such settings are made
> available to everyone, even though they are intended for those
> specific few who know what they're doing and who need specific
> functionality.  :-)

The same is true of rat poison... ;)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] IE can't download, FF can: SSL ? Need special headers?

2009-05-26 Thread Ashley Sheridan
On Tue, 2009-05-26 at 10:09 -0500, Dee Ayy wrote:
> Ashley,
> Don't scare me like that.  I know I'm losing my eye sight, but a
> copy-paste-diff shows your
> header("Content-Disposition: attachment; filename=\"$filename\"");
> differs from my original post's
> header("Content-Disposition: attachment; filename=\"$name\"");
> by only the text "file".  This method (with the other headers I used
> in my original post) fails on IE with the lame error:
> Internet Explorer was not able to open this Internet site.  The
> requested site is either unavailable or cannot be
> found.  Please try again later.
> 
> Hence the reason for my post in the first place.  If you would show
> your other headers for the \" quoted method, I'd be happy to test
> them.  Maybe you were comparing your method to my single tick method?
> 
> 
> Mike,
> rawurlencode (sounded promising) but did in fact leave it saved on the
> hard drive as %20 rather than + or the desired "space".  I find the
> str_replace spaces to underscores more readable, although saving to
> the hard drive with spaces would be best.  Thanks though.
> 
Sorry, i could have sworn it wasn't there, but I was probably looking at
a different thread. Just to recap, was it just the name of the file that
didn't carry across properly, or did the file not save at all?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Why does PHP have such a pain in the a$$ configuration file?

2009-05-26 Thread Andrew Ballard
On Tue, May 26, 2009 at 2:18 PM, Robert Cummings  wrote:
> On Tue, 2009-05-26 at 14:10 -0400, Andrew Ballard wrote:
>> On Tue, May 26, 2009 at 1:47 PM, Robert Cummings  
>> wrote:
>> > [snip] Such settings are usually made
>> > available to people who know what they're doing and who need specific
>> > functionality.
>> >
>> > Cheers,
>> > Rob.
>>
>> Not *quite* right. The problem is that such settings are made
>> available to everyone, even though they are intended for those
>> specific few who know what they're doing and who need specific
>> functionality.  :-)
>
> The same is true of rat poison... ;)
>
> Cheers,
> Rob.

Too true! But those who suffer ill effects from the misuse of rat
poison rarely get to complain.

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



[PHP] db messed up

2009-05-26 Thread PJ
I am probably not doing this right, but where else can I turn (don't
answer that!)...
this morning my wonderful local conEdison decided they were going to
waste my day by shutting off the power exactly as I was booting up my
server.
Hence, I cannot access a critical database... fortunately, I can redo
the database, but I'd like to know what I can to to fix the problem...
All other databases are functioning ok. Server is running ok,

mysql> CHECK TABLE producer;
ERROR 2006 (HY000): Mysql server has gone away
No connection. Trying to reconnect...
Connection id: 1
Current database: theproblem-one
Error 2006 (HY000: Mysql server has gone away
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/tmp/mysql.sock'   (61)
ERROR: Can't connect to the server
mysql>

090526 11:27:47 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '5.1.34'  socket: '/tmp/mysql.sock'  port: 3306  FreeBSD port: 
mysql-server-5.1.34
090526 11:32:14 [Note] /usr/local/libexec/mysqld: Normal shutdown

This was the time of the problem!
But when I look at /tmp/mysql.sock - it is 0 bytes.
Is this the problem? But I can connect to the other databases... :'( 

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] db messed up

2009-05-26 Thread Ashley Sheridan
On Tue, 2009-05-26 at 15:37 -0400, PJ wrote:
> I am probably not doing this right, but where else can I turn (don't
> answer that!)...
> this morning my wonderful local conEdison decided they were going to
> waste my day by shutting off the power exactly as I was booting up my
> server.
> Hence, I cannot access a critical database... fortunately, I can redo
> the database, but I'd like to know what I can to to fix the problem...
> All other databases are functioning ok. Server is running ok,
> 
> mysql> CHECK TABLE producer;
> ERROR 2006 (HY000): Mysql server has gone away
> No connection. Trying to reconnect...
> Connection id: 1
> Current database: theproblem-one
> Error 2006 (HY000: Mysql server has gone away
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket
> '/tmp/mysql.sock'   (61)
> ERROR: Can't connect to the server
> mysql>
> 
> 090526 11:27:47 [Note] /usr/local/libexec/mysqld: ready for connections.
> Version: '5.1.34'  socket: '/tmp/mysql.sock'  port: 3306  FreeBSD port: 
> mysql-server-5.1.34
> 090526 11:32:14 [Note] /usr/local/libexec/mysqld: Normal shutdown
> 
> This was the time of the problem!
> But when I look at /tmp/mysql.sock - it is 0 bytes.
> Is this the problem? But I can connect to the other databases... :'( 
> 
> -- 
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com
>http://www.ptahhotep.com
>http://www.chiccantine.com/andypantry.php
> 
> 
Have you tried to repair the table? I've only had to ever repair one
table (thankfully!) but the syntax I used was REPAIR TABLE tablename


Ash
www.ashleysheridan.co.uk


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



RE: [PHP] db messed up

2009-05-26 Thread Jay Blanchard
[snip]
...this morning my wonderful local conEdison ...
[/snip]

[snip]
... Hydro Quebec just f***ed my server just as I was booting...
[/snip]

I see that you asked this on the MySQL list which would be the correct
place to do this.

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



Re: [PHP] db messed up

2009-05-26 Thread PJ
Ashley Sheridan wrote:
> On Tue, 2009-05-26 at 15:37 -0400, PJ wrote:
>   
>> I am probably not doing this right, but where else can I turn (don't
>> answer that!)...
>> this morning my wonderful local conEdison decided they were going to
>> waste my day by shutting off the power exactly as I was booting up my
>> server.
>> Hence, I cannot access a critical database... fortunately, I can redo
>> the database, but I'd like to know what I can to to fix the problem...
>> All other databases are functioning ok. Server is running ok,
>>
>> mysql> CHECK TABLE producer;
>> ERROR 2006 (HY000): Mysql server has gone away
>> No connection. Trying to reconnect...
>> Connection id: 1
>> Current database: theproblem-one
>> Error 2006 (HY000: Mysql server has gone away
>> ERROR 2002 (HY000): Can't connect to local MySQL server through socket
>> '/tmp/mysql.sock'   (61)
>> ERROR: Can't connect to the server
>> mysql>
>>
>> 090526 11:27:47 [Note] /usr/local/libexec/mysqld: ready for connections.
>> Version: '5.1.34'  socket: '/tmp/mysql.sock'  port: 3306  FreeBSD port: 
>> mysql-server-5.1.34
>> 090526 11:32:14 [Note] /usr/local/libexec/mysqld: Normal shutdown
>>
>> This was the time of the problem!
>> But when I look at /tmp/mysql.sock - it is 0 bytes.
>> Is this the problem? But I can connect to the other databases... :'( 
>>
>> -- 
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>>
>>
>> 
> Have you tried to repair the table? I've only had to ever repair one
> table (thankfully!) but the syntax I used was REPAIR TABLE tablename
>
>
> Ash
> www.ashleysheridan.co.uk
>
>
>   
Somehow, I knew you would come through :-)
I'm afraid that there seems to be no way to connect to that particular
database.
I've tried about everything I could find on the web, the  manuals, etc.
Since the server is running, mysql is running, the other databases
connect and execute. So, I suppose the only option is to try to create a
new dataabase and probably delete the old stuff from the machine. ???

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] db messed up

2009-05-26 Thread PJ
Jay Blanchard wrote:
> [snip]
> ...this morning my wonderful local conEdison ...
> [/snip]
>
> [snip]
> ... Hydro Quebec just f***ed my server just as I was booting...
> [/snip]
>
> I see that you asked this on the MySQL list which would be the correct
> place to do this.
>
>   
As you are aware, you have nothing to offer, for if you did, you would
have posted it on the MySQL list. So why are you butting in? I know what
I am doing and where to look for help... obviously, the other list isn't
as knowledgable as is this one. :-P

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



Re: [PHP] db messed up

2009-05-26 Thread Ashley Sheridan
On Tue, 2009-05-26 at 15:53 -0400, PJ wrote:
> Ashley Sheridan wrote:
> > On Tue, 2009-05-26 at 15:37 -0400, PJ wrote:
> >   
> >> I am probably not doing this right, but where else can I turn (don't
> >> answer that!)...
> >> this morning my wonderful local conEdison decided they were going to
> >> waste my day by shutting off the power exactly as I was booting up my
> >> server.
> >> Hence, I cannot access a critical database... fortunately, I can redo
> >> the database, but I'd like to know what I can to to fix the problem...
> >> All other databases are functioning ok. Server is running ok,
> >>
> >> mysql> CHECK TABLE producer;
> >> ERROR 2006 (HY000): Mysql server has gone away
> >> No connection. Trying to reconnect...
> >> Connection id: 1
> >> Current database: theproblem-one
> >> Error 2006 (HY000: Mysql server has gone away
> >> ERROR 2002 (HY000): Can't connect to local MySQL server through socket
> >> '/tmp/mysql.sock'   (61)
> >> ERROR: Can't connect to the server
> >> mysql>
> >>
> >> 090526 11:27:47 [Note] /usr/local/libexec/mysqld: ready for connections.
> >> Version: '5.1.34'  socket: '/tmp/mysql.sock'  port: 3306  FreeBSD port: 
> >> mysql-server-5.1.34
> >> 090526 11:32:14 [Note] /usr/local/libexec/mysqld: Normal shutdown
> >>
> >> This was the time of the problem!
> >> But when I look at /tmp/mysql.sock - it is 0 bytes.
> >> Is this the problem? But I can connect to the other databases... :'( 
> >>
> >> -- 
> >> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> >> -
> >> Phil Jourdan --- p...@ptahhotep.com
> >>http://www.ptahhotep.com
> >>http://www.chiccantine.com/andypantry.php
> >>
> >>
> >> 
> > Have you tried to repair the table? I've only had to ever repair one
> > table (thankfully!) but the syntax I used was REPAIR TABLE tablename
> >
> >
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
> >   
> Somehow, I knew you would come through :-)
> I'm afraid that there seems to be no way to connect to that particular
> database.
> I've tried about everything I could find on the web, the  manuals, etc.
> Since the server is running, mysql is running, the other databases
> connect and execute. So, I suppose the only option is to try to create a
> new dataabase and probably delete the old stuff from the machine. ???
> 
> -- 
> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
> -
> Phil Jourdan --- p...@ptahhotep.com
>http://www.ptahhotep.com
>http://www.chiccantine.com/andypantry.php
> 
> 
I can't find anything that will repair a whole database, only individual
tables. It's odd that you can't even connect to the database at all, :-/


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] db messed up

2009-05-26 Thread PJ
Ashley Sheridan wrote:
> On Tue, 2009-05-26 at 15:53 -0400, PJ wrote:
>   
>> Ashley Sheridan wrote:
>> 
>>> On Tue, 2009-05-26 at 15:37 -0400, PJ wrote:
>>>   
>>>   
 I am probably not doing this right, but where else can I turn (don't
 answer that!)...
 this morning my wonderful local conEdison decided they were going to
 waste my day by shutting off the power exactly as I was booting up my
 server.
 Hence, I cannot access a critical database... fortunately, I can redo
 the database, but I'd like to know what I can to to fix the problem...
 All other databases are functioning ok. Server is running ok,

 mysql> CHECK TABLE producer;
 ERROR 2006 (HY000): Mysql server has gone away
 No connection. Trying to reconnect...
 Connection id: 1
 Current database: theproblem-one
 Error 2006 (HY000: Mysql server has gone away
 ERROR 2002 (HY000): Can't connect to local MySQL server through socket
 '/tmp/mysql.sock'   (61)
 ERROR: Can't connect to the server
 mysql>

 090526 11:27:47 [Note] /usr/local/libexec/mysqld: ready for connections.
 Version: '5.1.34'  socket: '/tmp/mysql.sock'  port: 3306  FreeBSD port: 
 mysql-server-5.1.34
 090526 11:32:14 [Note] /usr/local/libexec/mysqld: Normal shutdown

 This was the time of the problem!
 But when I look at /tmp/mysql.sock - it is 0 bytes.
 Is this the problem? But I can connect to the other databases... :'( 

 -- 
 Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
 -
 Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php


 
 
>>> Have you tried to repair the table? I've only had to ever repair one
>>> table (thankfully!) but the syntax I used was REPAIR TABLE tablename
>>>
>>>
>>> Ash
>>> www.ashleysheridan.co.uk
>>>
>>>
>>>   
>>>   
>> Somehow, I knew you would come through :-)
>> I'm afraid that there seems to be no way to connect to that particular
>> database.
>> I've tried about everything I could find on the web, the  manuals, etc.
>> Since the server is running, mysql is running, the other databases
>> connect and execute. So, I suppose the only option is to try to create a
>> new dataabase and probably delete the old stuff from the machine. ???
>>
>> -- 
>> Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
>> -
>> Phil Jourdan --- p...@ptahhotep.com
>>http://www.ptahhotep.com
>>http://www.chiccantine.com/andypantry.php
>>
>>
>> 
> I can't find anything that will repair a whole database, only individual
> tables. It's odd that you can't even connect to the database at all, :-/
phpMyAdmin closes when trying to access that db and asks for a login.
I'll try to finagle things the old band-aid way and try to recreate the
damned thing... maybe, if I delete it all (backups, of course) and the
create a new db with same name & then repopulate it with the existing
files... who knows...
Thanks, as always..
Phil

-- 
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



RE: [PHP] db messed up

2009-05-26 Thread Jay Blanchard
[snip]
As you are aware, you have nothing to offer, for if you did, you would
have posted it on the MySQL list. So why are you butting in? I know what
I am doing and where to look for help... obviously, the other list isn't
as knowledgable as is this one. :-P
[/snip]

Oh a little testy today are we? Not getting any?

Have you checked the error log? 

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



RE: [PHP] db messed up

2009-05-26 Thread Jay Blanchard
[snip]
phpMyAdmin closes when trying to access that db and asks for a login.
[/snip]

Can you connect to the MySQL server from the command line and see the
database? If so your likely problem is a config file issue with
phpmyadmin?
 

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



[PHP] Re: db messed up

2009-05-26 Thread Shawn McKenzie
PJ wrote:
> I am probably not doing this right, but where else can I turn (don't
> answer that!)...
> this morning my wonderful local conEdison decided they were going to
> waste my day by shutting off the power exactly as I was booting up my
> server.
> Hence, I cannot access a critical database... fortunately, I can redo
> the database, but I'd like to know what I can to to fix the problem...
> All other databases are functioning ok. Server is running ok,
> 
> mysql> CHECK TABLE producer;
> ERROR 2006 (HY000): Mysql server has gone away
> No connection. Trying to reconnect...
> Connection id: 1
> Current database: theproblem-one
> Error 2006 (HY000: Mysql server has gone away
> ERROR 2002 (HY000): Can't connect to local MySQL server through socket
> '/tmp/mysql.sock'   (61)
> ERROR: Can't connect to the server
> mysql>
> 
> 090526 11:27:47 [Note] /usr/local/libexec/mysqld: ready for connections.
> Version: '5.1.34'  socket: '/tmp/mysql.sock'  port: 3306  FreeBSD port: 
> mysql-server-5.1.34
> 090526 11:32:14 [Note] /usr/local/libexec/mysqld: Normal shutdown
> 
> This was the time of the problem!
> But when I look at /tmp/mysql.sock - it is 0 bytes.
> Is this the problem? But I can connect to the other databases... :'( 
> 

Been a while for me on BSD, but try:

/usr/local/etc/rc.d/mysql-server stop
rm /tmp/mysql.sock
/usr/local/etc/rc.d/mysql-server start


-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] html and password management

2009-05-26 Thread Michael A. Peters

kranthi wrote:

seems more of a firefox question than a PHP question...

just replace 
with 

https://developer.mozilla.org/en/How_to_Turn_Off_form_Autocompletion



Thanks!

I found that for xhtml I had to use following DOCTYPE to get it to validate:

"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"; [


]>

From what I gather though did not try, sent with improper text/html 
mime type, browsers add a bogus ]> to top of output, declaring an 
ATTLIST should only be done if sent as application/xhtml+xml


I still have to check and see how opera reacts to that (IE gets html 
version of my pages so it won't get that anyway, I can't test safari)


html won't validate with that attribute, but that's OK I guess.
Maybe it will in html 5 (I don't know) but that's not even stable yet.

I'd prefer it to be at the input level rather than form level, the 
problem (and I think it is a firefox bug) is that it assumes an input 
before a password the same form as a password is a login name.


I *might* actually be able to just move the password field above the 
e-mail change and fix it.


But the autocomplete='off' is very useful to me for another form where 
users add GPS coordinates, which are from within shasta county and thus 
all very close, unless the records are for identical coordinates they'll 
never be the same and if they are identical, using the autocomplete 
feature risks a mistake of selecting the wrong one thus resulting in 
bogus data.




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



Re: [PHP] templating engine options

2009-05-26 Thread Tom Worster
On 5/25/09 8:48 PM, "Nathan Rixham"  wrote:

> Sancar Saran wrote:
>> > $content = 'No Comments';
>> if(isset($comments) and is_array($comments) and count($comments) > 0 ) {
>> $content = '';
>> foreach( $comments as $index => $comment ) : $content. = "".$comment->title.""; endforeach;
>> }
>> ?>
>> 
>> Comments
>> 
>> 
>> 
>> 
>> index.php
>> ob_start();
>> require('template.php');
>> echo ob_get_clean();
>> 
>> 
>> I'm still do not understand for complex template system requirement.
> 
> I just _need_ the two abstracted.
> 
> php must have no html in it
> html template must contain no php

i can achieve that separation in phplib using blocks, i.e blocks of template
that may be repeatedly replaced, hierarchically if so desired. presumably
smarty has something equivalent. but, naturally, this doesn't meet your
"pull" requirement.

hoever, i sometimes find that some mixing is inevitable. for example, if i
am listing  music recordings but not using a table, just a list. my template
might be (leaving out the classes and ids. and humor me in my old-fashioned
tag preferences):


{artist}, {disk} {label}


that works but if my database entry for a given disk has no information on
the label then the html output looks a but nasty:

Mika Miko, We Be Xuxa 

which sort of works but offends my sensibilities. since phplib doesn't have
a way to make a chunk of template conditional (other than with a block,
which would become a pita as you can imagine from the above), i sigh, shrug
and move the  in the conditional in the script. oh well. purity is
idealistic.


a possible solution would be to define macros in the template, maybe...

{MACRO:label=, {label}}

that would give me an optional comma and get rid of the space if there's no
label data while keeping all html out of the script.

while this achieves the ideal of separation i'm not sure it's really more
practical than the impurity of having some html bits in the script. having
practical experience with just one approach i can only speak theoretically
of the other.

(btw: macros can in fact be done in phplib templates by putting each macro
in a template file of its own, but that doesn't sound too practical in the
long run, does it?)


on another different topic, i would make independence of the output language
a requirement of the template scheme. e.g. besides html, i use phplib
templates to generate plain text emails, sql files, json ajax responses,
whatever...



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



Re: [PHP] templating engine options

2009-05-26 Thread Tom Worster
thanks for taking the trouble to write your requirements. it made
interesting reading.

i've questions on three points below...


On 5/25/09 6:44 PM, "Nathan Rixham"  wrote:

> XSL Templates are near perfect, built for the job, and very powerful -
> but time hasn't favoured them well; and until (if ever) a wide spread
> adoption happens something else needs to fill the gap.

i don't know xsl well, but from what i read it seems to be about taking data
from one xml document and putting it into another. that sounds reasonable
except that the data that i want to combine with my template (either pushing
it pulling) is in php variable state, not an xml document.

however, it seems that one could write a php template class that takes xslt
template files and data from the script?


one thing i wasn't clear about with xsl is whether or not there's any output
language dependence? could i write a template to produce an sql file, or an
email in russian?


> Push vs Pull.
>
...
> The freedom to be able to specify in template that...
> 
> this is template module "latest posts", it is bound to the data view (or
> data provider) "latest posts(8)"
> whilst overall combining template (page) is comprised of modules x,y and
> z - here, here and here.
> 
> ...really appeals to me; certainly in this scenario where you request
> (pull) from the application rather than make it all available. This way
> you only ever perform the business logic required for the information
> available. The counter part of making everything available incase it may
> be used is ridiculous (and makes me think coldfusion for some reason??).
> 
> Architecturally this appears to be good - it's the presentation tier
> being a presentation tier, the logic tier knows nothing of the
> presentation tier and simply serves up what is requested. However thats
> only on the one side of the tier - on the other side we have a huge
> gaping hole where functionality should be (cache, compilation, delivery)
> etc, which would require another, as yet unknown layer (or 2).
> 
> The abstraction and separation of concerns in this setup really appeals
> - but practically I'm not sure if the time spent implementing on a small
> or even medium sized project would be worth it. Still appeals massively
> though - pull makes more logical sense to me.
> 
> Meanwhile, we have the first option, the way it's done, "push" the data
> - specify a template for that data and let template engine X do the
> merging. IMHO a clean, simple, lightweight implementation wouldn't be
> the hardest thing to make, and hundreds of apps are freely available all
> ready.

i don't think i follow you.

it seems you're saying that there would be some kind of an intermediate
level of data representation that a script can be invoked to produce from
which different templates can produce different outputs.

but i can't see any difficulty in achieving similar modularity and reuse
with available push template schemes and appropriate division of code among
include files. one includable script generates the intermediate view while
others use various templates to use it in output.

so i think i'm missing something in your definition of pull.



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



Re: [PHP] db messed up

2009-05-26 Thread Tom Worster
On 5/26/09 4:11 PM, "Ashley Sheridan"  wrote:

> I can't find anything that will repair a whole database, only individual
> tables. It's odd that you can't even connect to the database at all, :-/

isn't mysql_upgrade --force a script that effectively runs repair table on
all your databases and tables?



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



Re: [PHP] templating engine options

2009-05-26 Thread Nathan Rixham

Tom Worster wrote:

thanks for taking the trouble to write your requirements. it made
interesting reading.


and thanks for taking the time to read it! it was a big one.


i've questions on three points below...


On 5/25/09 6:44 PM, "Nathan Rixham"  wrote:


XSL Templates are near perfect, built for the job, and very powerful -
but time hasn't favoured them well; and until (if ever) a wide spread
adoption happens something else needs to fill the gap.


i don't know xsl well, but from what i read it seems to be about taking data
from one xml document and putting it into another. that sounds reasonable
except that the data that i want to combine with my template (either pushing
it pulling) is in php variable state, not an xml document.


yes, transforming one document to another, using templates. works v well.

php already implements xsl and its well supported using DOMDocuments and 
suchlike. however it's also supported on the client side in browser, 
which is a major selling point as you just send down the raw data 
formatted as xml and let the xsl stylesheets do all the work in the 
browser - so much weight off the server / app!


to get the raw php data to xml is easy, there are already a tonne of 
array/object to xml converters available, and you can make one in a snap.



however, it seems that one could write a php template class that takes xslt
template files and data from the script?



no need, http://php.net/xsl fully supported and uses DOMDocuments 
/DOMXpath the works. its all native to php 5 and above (and in php4 its 
http://php.net/xslt)



one thing i wasn't clear about with xsl is whether or not there's any output
language dependence? could i write a template to produce an sql file, or an
email in russian?


none that I know of - its a w3c recommended standard and imho one of the 
best written, practically everything you can think of is covered.


if you have never tried xsl its really worth taking an hour or two out 
giving it a go, if you want some starting points just say.


+xslt is supported by every major language, and most browsers like 
firefox, internet explorer, safari etc etc





Push vs Pull.


...

The freedom to be able to specify in template that...

this is template module "latest posts", it is bound to the data view (or
data provider) "latest posts(8)"
whilst overall combining template (page) is comprised of modules x,y and
z - here, here and here.

...really appeals to me; certainly in this scenario where you request
(pull) from the application rather than make it all available. This way
you only ever perform the business logic required for the information
available. The counter part of making everything available incase it may
be used is ridiculous (and makes me think coldfusion for some reason??).

Architecturally this appears to be good - it's the presentation tier
being a presentation tier, the logic tier knows nothing of the
presentation tier and simply serves up what is requested. However thats
only on the one side of the tier - on the other side we have a huge
gaping hole where functionality should be (cache, compilation, delivery)
etc, which would require another, as yet unknown layer (or 2).

The abstraction and separation of concerns in this setup really appeals
- but practically I'm not sure if the time spent implementing on a small
or even medium sized project would be worth it. Still appeals massively
though - pull makes more logical sense to me.

Meanwhile, we have the first option, the way it's done, "push" the data
- specify a template for that data and let template engine X do the
merging. IMHO a clean, simple, lightweight implementation wouldn't be
the hardest thing to make, and hundreds of apps are freely available all
ready.


i don't think i follow you.

it seems you're saying that there would be some kind of an intermediate
level of data representation that a script can be invoked to produce from
which different templates can produce different outputs.

but i can't see any difficulty in achieving similar modularity and reuse
with available push template schemes and appropriate division of code among
include files. one includable script generates the intermediate view while
others use various templates to use it in output.

so i think i'm missing something in your definition of pull.



yup, the modularity can be easily achieved using push, but with push you 
have to effectively send everything that can be needed to the template 
engine, then the template can either show all of it, some of it or whatever.


but with this method of pull, the template would be pre-parsed to see 
what was required, then the app would generate and provide only what was 
needed for that specific template. Thus saving you generating a load of 
unneeded data "incase" the template might want to use it.


clear? if not just say.

regards!

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



Re: [PHP] templating engine options

2009-05-26 Thread Nathan Rixham

Tom Worster wrote:

On 5/25/09 8:48 PM, "Nathan Rixham"  wrote:


Sancar Saran wrote:

 0 ) {
$content = '';
foreach( $comments as $index => $comment ) : $content. = "".$comment->title.""; endforeach;
}
?>

Comments




index.php
ob_start();
require('template.php');
echo ob_get_clean();


I'm still do not understand for complex template system requirement.

I just _need_ the two abstracted.

php must have no html in it
html template must contain no php


i can achieve that separation in phplib using blocks, i.e blocks of template
that may be repeatedly replaced, hierarchically if so desired. presumably
smarty has something equivalent. but, naturally, this doesn't meet your
"pull" requirement.

hoever, i sometimes find that some mixing is inevitable. for example, if i
am listing  music recordings but not using a table, just a list. my template
might be (leaving out the classes and ids. and humor me in my old-fashioned
tag preferences):


{artist}, {disk} {label}


that works but if my database entry for a given disk has no information on
the label then the html output looks a but nasty:

Mika Miko, We Be Xuxa 

which sort of works but offends my sensibilities. since phplib doesn't have
a way to make a chunk of template conditional (other than with a block,
which would become a pita as you can imagine from the above), i sigh, shrug
and move the  in the conditional in the script. oh well. purity is
idealistic.


a possible solution would be to define macros in the template, maybe...

{MACRO:label=, {label}}

that would give me an optional comma and get rid of the space if there's no
label data while keeping all html out of the script.

while this achieves the ideal of separation i'm not sure it's really more
practical than the impurity of having some html bits in the script. having
practical experience with just one approach i can only speak theoretically
of the other.

(btw: macros can in fact be done in phplib templates by putting each macro
in a template file of its own, but that doesn't sound too practical in the
long run, does it?)


on another different topic, i would make independence of the output language
a requirement of the template scheme. e.g. besides html, i use phplib
templates to generate plain text emails, sql files, json ajax responses,
whatever...



you know you just reminded me of something..

for the past couple of years I've been working regularly on a huge 
website which was made totally and completely terribly, everything about 
it was just dire (worst code I've seen)


however, eating my above word here, I've just realised that the mini 
custom template engine they used (whilst heavy and crap) actually 
implemented pull!


in template they'd have

%user_stories_2%

which would actually mean "run function user_stories_2 and place output 
here" - if the function wasn't defined it just replaced it with '' 
(nothing).


so.. that is in fact pull, in a simple way - it doesn't cater for 
allowing you to control the html output or suchlike, but the 
optimization features and the general process was implemented.


damn I'm having a learning day/week. also noticed yesterday that a v v v 
important and big project at the day job (which was going wrong and slow 
for ages) has actually been designed wrong - it's implemented an 
"anemic domain model" and a tonne of services, which completely kills 
the point of using a domain model - couldn't put my finger on it before 
but did today! also realised my own ORM was pants because I'd designed 
it wrong using inheritance and created a mess of cross cutting concerns 
which means the data layer can't be replaced easily - in short I've 
implemented:

$country->saveOrUpdate();
but it should be:
Persistence::saveOrUpdate( $country );
(thus allowing the persistence layer to be swapped out without business 
logic or domain model needing to be changed)


sigh but joy!

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



Re: [PHP] templating engine options

2009-05-26 Thread Tom Worster
thanks for the pointers on xsl. i'll take a look.


On 5/26/09 6:05 PM, "Nathan Rixham"  wrote:

>> it seems you're saying that there would be some kind of an intermediate
>> level of data representation that a script can be invoked to produce from
>> which different templates can produce different outputs.
>> 
>> but i can't see any difficulty in achieving similar modularity and reuse
>> with available push template schemes and appropriate division of code among
>> include files. one includable script generates the intermediate view while
>> others use various templates to use it in output.
>> 
>> so i think i'm missing something in your definition of pull.
>> 
> 
> yup, the modularity can be easily achieved using push, but with push you
> have to effectively send everything that can be needed to the template
> engine, then the template can either show all of it, some of it or whatever.
> 
> but with this method of pull, the template would be pre-parsed to see
> what was required, then the app would generate and provide only what was
> needed for that specific template. Thus saving you generating a load of
> unneeded data "incase" the template might want to use it.
> 
> clear? if not just say.

it seems that you want to put certain parameters that configure the
generation of the data that's to go into the output into the actual template
files. if those parameters could instead be located in a php file somewhere
then push would work as well. right?



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



[PHP] Re: [PHP-DEV] PHP scalability problem

2009-05-26 Thread Eddie Drapkin
Processes are only spawned in shitty webserver processing models that high
performing webservers don't even have.  If you'll read my first link, php is
rarely the client-side bottleneck (which is all that matters).  And do some
research, on a page that hits the database for me, the query is usually
50-80% of prosecution speed, so design a faster db schema or use a faster
RDBMS (or high performing MySQL builds).  Offloading processing is rarely
possible and is not the solution to scaling your web application, somewhere
along the line your server will fail (if you have enough success) and you'll
have to get a new one.  Scaling gracefully is more about horizontal
expansion and getting the most for your buck, delaying the inevitable.

Some things you probably ought to keep in mind
1) Client side performance is the only thing that matters.  If your server
load is at 110 but pages are still generating in less time than it takes to
make the HTTP handshake (which I estimate <0.1 seconds is a fair target),
then you have no worries.  Install ySlow and study its documentation
thoroughly and accept no less than high 90s for your work.

2) Scaling requires a fundamental paradigm of speed built in to the core
logic of your application.  It's easier to start with a persistent caching
setup and go from there than apply one later.  Look into memcache,
memcachedb, and apc for some absolutely required tools.

3) The solution to save your server from doing the majority of the work
isn't to load it onto the clients, that'll result in your ownership of a
laggy, unresponsive site no one wants to use.  I guess that would solve your
problem, though, by taking away all your users.

4) Start establishing good performance habits, use a profiler like xdebug
and identify your bottlenecks and optimize them.  Saving 10ms on a logic
setup is meaningless if every pageload has 200ms of queries it has to run.
SQL *will* be your benchmark long before PHP or apache will be.  Look into
setting your SQL server up as fast as you can.  Hint: default installs and
configurations are never as fast as they could be.

5) Use ajax when you can instead of full page reloads.  It saves a lot of
overhead i/o if done properly.

6) Install an opcode cache, I recommend EAccelerator.  Script CPU time will
be decreased by (a) order of magnitude(s).

7) Scalability is a lot of SEO, there's no one magic thing you can do, it's
a combination of dozens of tiny little things and it's probably the most
difficult thing about writing PHP.  Don't expect someone to email this list
and say "Do X, Y and Z and you'll never have to worry about scaling!"
because they'll be lying to you if that does happen.

On a side note, I noticed this is the wrong list and CC'd the correct one.

On Tue, May 26, 2009 at 11:04 PM, tRace DOliveira wrote:

>
> What I am trying to achieve is to have the server do less processing. Like
> I said PHP is a server side scripting language and each time a request is
> made a process is spawned and processes are heavy weight as compared to a
> thread which is a light weight process. So I want to take away much
> processing away from the server and have the client do it instead. Because
> if many requests are made the server will eventually go down because it will
> over the server.
> **
>
>
> From: Eddie Drapkin 
> Subject: Re: [PHP-DEV] PHP scalability problem
> To: "tRace DOliveira" 
> Cc: intern...@lists.php.net
> Date: Wednesday, May 27, 2009, 2:55 AM
>
>
> 1) PHP is Rarely The Bottleneck: 
> http://talks.php.net/show/drupal08/
> 2) Invest in an opcode cache
> 3) DB I/O is always the most restrictive part of your application, read the
> mysql performance blog (a lot applies for postgres too)
> 4) If you're serious about scalability, ditch apache and use a better
> webserver
> 5) You're describing what ajax does in a lot of cases
> 6) Have you deployed flatfile cache / apc / memcached?  If so, how?
> 7) Do you regularly run siege tests on new server stacks and profile each
> piece's impact on performance?
> 8) Do you profile your code every time you change some piece of logic?
>
> Scalability is an enormous mountain to climb and there's only so much you
> can offload on to the client.  Chances are there's more room for improvement
> at any stage in your development than there is potentiality for client-side
> processing.
>
> On Tue, May 26, 2009 at 10:46 PM, tRace DOliveira 
> http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>
> > wrote:
>
>> PHP is a server side scripting language, so that means that the server
>> will have to do the bulk of the processing if not most.
>> I was thinking about shifting the processing to the client. Kinda like how
>> java does it. I don't know really know how java does it but it would be
>> interesting if it could be done for PHP also.
>> Thank you,
>> Leonard D'Oliveira
>>
>>
>>
>
>
>
>


[PHP] PHP scalability problem

2009-05-26 Thread tRace DOliveira
What I am trying to achieve is to have the server do less processing. Like I 
said PHP is a server side scripting language and each time a request is made a 
process is spawned and processes are heavy weight as compared to a thread which 
is a light weight process. So I want to take away much processing away from the 
server and have the client do it instead. Because if many requests are made the 
server will eventually go down because it will over the server.I am not trying 
to get away from PHP but I am trying to solve the problem of scalability
Thank you, 
Leonard D'Oliveira


  

[PHP] Re: [PHP-DEV] PHP scalability problem

2009-05-26 Thread Eddie Drapkin
I seriously doubt it.  PHP is a better language in almost all regards and is
much much more popular.  A lot of people make that decision every day and
I'd say most of them choose PHP.  Why ask that, though?

On Tue, May 26, 2009 at 11:36 PM, tRace DOliveira wrote:

>
> Do you agree with me that when building a large web application that people
> would rather choose ASP.Net over PHP if people had to choose between those
> two ?
> --- On *Wed, 5/27/09, Eddie Drapkin * wrote:
>
>
> From: Eddie Drapkin 
> Subject: Re: [PHP-DEV] PHP scalability problem
> To: "Michael Shadle" 
> Cc: "tRace DOliveira" , "intern...@lists.php.net" <
> intern...@lists.php.net>
> Date: Wednesday, May 27, 2009, 3:29 AM
>
>
> nginx and php-fpm is the fastest setup I could find, after spending almost
> 2 weeks trying different combinations.
>
> Apache pre-fork model: 1900 reqs/second (this is with running queries per
> pageload)
> nginx w/ fpm: 3400 reqs/second
>
> And nginx's doc setup is awesome.
>
> Like Michael said, scaling PHP itself is no big deal, just add more worker
> nodes to your process pool, the issue is scaling out your sql server
> (memcache scaling is piss easy too)
>
> On Tue, May 26, 2009 at 11:24 PM, Michael Shadle 
> http://us.mc1104.mail.yahoo.com/mc/compose?to=mike...@gmail.com>
> > wrote:
>
>> Succinct and great reply.
>>
>> Better webserver: nginx :)
>>
>> #3 is probably the most important piece.
>>
>> I'd like to also note scaling php is pretty simple. Scaling out typically
>> provides better results as opposed to scaling up. Scaling your datastore
>> will always be your pain point. Adding new data nodes is complex. Adding
>> more php processing nodes is simple. Php nodes are just worker bees. They're
>> great for shared-nothing processing engines.
>>
>> I can't think of a good metaphor right now other than that.
>>
>> On May 26, 2009, at 7:55 PM, Eddie Drapkin 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>>
>> wrote:
>>
>>  1) PHP is Rarely The Bottleneck:
>>> http://talks.php.net/show/drupal08/
>>>
>>>
>>> 2) Invest in an opcode cache
>>> 3) DB I/O is always the most restrictive part of your application, read
>>> the
>>> mysql performance blog (a lot applies for postgres too)
>>> 4) If you're serious about scalability, ditch apache and use a better
>>> webserver
>>> 5) You're describing what ajax does in a lot of cases
>>> 6) Have you deployed flatfile cache / apc / memcached?  If so, how?
>>> 7) Do you regularly run siege tests on new server stacks and profile each
>>> piece's impact on performance?
>>> 8) Do you profile your code every time you change some piece of logic?
>>>
>>> Scalability is an enormous mountain to climb and there's only so much you
>>> can offload on to the client.  Chances are there's more room for
>>> improvement
>>> at any stage in your development than there is potentiality for
>>> client-side
>>> processing.
>>>
>>> On Tue, May 26, 2009 at 10:46 PM, tRace DOliveira 
>>> http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>
>>> >wrote:
>>>
>>> PHP is a server side scripting language, so that means that the server
 will
 have to do the bulk of the processing if not most.
 I was thinking about shifting the processing to the client. Kinda like
 how
 java does it. I don't know really know how java does it but it would be
 interesting if it could be done for PHP also.
 Thank you,
 Leonard D'Oliveira




>
>


[PHP] [PHP-DEV] PHP scalability problem

2009-05-26 Thread Eddie Drapkin
... no

Apache uses processes, but can also use threads.  nginx and lighttpd both
use a threaded model.  But you seem to have this idea in your head that it's
PHP's fault and switching to a threaded webserver / CGI model will solve any
noticeable scalability problems, so feel free to ditch PHP for ASP because
you think it'll be anywhat faster.  I'll save you some time: it won't.


On Tue, May 26, 2009 at 11:44 PM, tRace DOliveira wrote:

>
> What I am trying to get at is that PHP uses processes(Heavy weight) and
> ASP.NET uses threads which are light weight. So it inflicts less strain
> upon the web server. So I am trying to solve the problem of the strain that
> PHP causes on ther server.
> --- On *Wed, 5/27/09, Eddie Drapkin * wrote:
>
>
> From: Eddie Drapkin 
> Subject: Re: [PHP-DEV] PHP scalability problem
> To: "tRace DOliveira" 
> Cc: "PHP General Mailing List" 
> Date: Wednesday, May 27, 2009, 3:39 AM
>
>
>
> I seriously doubt it.  PHP is a better language in almost all regards and
> is much much more popular.  A lot of people make that decision every day and
> I'd say most of them choose PHP.  Why ask that, though?
>
> On Tue, May 26, 2009 at 11:36 PM, tRace DOliveira 
> http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>
> > wrote:
>
>>
>> Do you agree with me that when building a large web application that
>> people would rather choose ASP.Net over PHP if people had to choose between
>> those two ?
>> --- On *Wed, 5/27/09, Eddie Drapkin 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>
>> >* wrote:
>>
>>
>> From: Eddie Drapkin 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>
>> >
>> Subject: Re: [PHP-DEV] PHP scalability problem
>> To: "Michael Shadle" 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=mike...@gmail.com>
>> >
>> Cc: "tRace DOliveira" 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>>,
>> "intern...@lists.php.net"
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=intern...@lists.php.net>
>> >
>> Date: Wednesday, May 27, 2009, 3:29 AM
>>
>>
>> nginx and php-fpm is the fastest setup I could find, after spending almost
>> 2 weeks trying different combinations.
>>
>> Apache pre-fork model: 1900 reqs/second (this is with running queries per
>> pageload)
>> nginx w/ fpm: 3400 reqs/second
>>
>> And nginx's doc setup is awesome.
>>
>> Like Michael said, scaling PHP itself is no big deal, just add more worker
>> nodes to your process pool, the issue is scaling out your sql server
>> (memcache scaling is piss easy too)
>>
>> On Tue, May 26, 2009 at 11:24 PM, Michael Shadle 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=mike...@gmail.com>
>> > wrote:
>>
>>> Succinct and great reply.
>>>
>>> Better webserver: nginx :)
>>>
>>> #3 is probably the most important piece.
>>>
>>> I'd like to also note scaling php is pretty simple. Scaling out typically
>>> provides better results as opposed to scaling up. Scaling your datastore
>>> will always be your pain point. Adding new data nodes is complex. Adding
>>> more php processing nodes is simple. Php nodes are just worker bees. They're
>>> great for shared-nothing processing engines.
>>>
>>> I can't think of a good metaphor right now other than that.
>>>
>>> On May 26, 2009, at 7:55 PM, Eddie Drapkin 
>>> http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>>
>>> wrote:
>>>
>>>  1) PHP is Rarely The Bottleneck:
 http://talks.php.net/show/drupal08/<
 http://talks.php.net/show/drupal08/7>

 2) Invest in an opcode cache
 3) DB I/O is always the most restrictive part of your application, read
 the
 mysql performance blog (a lot applies for postgres too)
 4) If you're serious about scalability, ditch apache and use a better
 webserver
 5) You're describing what ajax does in a lot of cases
 6) Have you deployed flatfile cache / apc / memcached?  If so, how?
 7) Do you regularly run siege tests on new server stacks and profile
 each
 piece's impact on performance?
 8) Do you profile your code every time you change some piece of logic?

 Scalability is an enormous mountain to climb and there's only so much
 you
 can offload on to the client.  Chances are there's more room for
 improvement
 at any stage in your development than there is potentiality for
 client-side
 processing.

 On Tue, May 26, 2009 at 10:46 PM, tRace DOliveira 
 http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>
 >wrote:

 PHP is a server side scripting language, so that means that the server
> will
> have to do the bulk of the processing if not most.
> I was thinking about shifting the processing to the client. Kinda like
> how
> java does it. I don't know really know how java does it but it would be
> interesting if it could be done for PHP also.
> Thank you,
> Leona

[PHP] [PHP-DEV] PHP scalability problem

2009-05-26 Thread Eddie Drapkin
If you think that's a problem, then yes.  Look into nginx.  But honestly,
you're not going to notice a speed improvement at all (maybe if you were
serving 2000 loads/sec you would, but only then if it's on a small box).



On Tue, May 26, 2009 at 11:52 PM, tRace DOliveira wrote:

>  I also thought that it's PHP that causes the processes. Thanks that helps
> me alot. So the problem is not with the language itself but the web
> server(Apache)?
>
> --- On *Wed, 5/27/09, Eddie Drapkin * wrote:
>
>
> From: Eddie Drapkin 
> Subject: Re: [PHP-DEV] PHP scalability problem
> To: "tRace DOliveira" 
> Date: Wednesday, May 27, 2009, 3:47 AM
>
>
> ... no
>
> Apache uses processes, but can also use threads.  nginx and lighttpd both
> use a threaded model.  But you seem to have this idea in your head that it's
> PHP's fault and switching to a threaded webserver / CGI model will solve any
> noticeable scalability problems, so feel free to ditch PHP for ASP because
> you think it'll be anywhat faster.  I'll save you some time: it won't.
>
> On Tue, May 26, 2009 at 11:44 PM, tRace DOliveira 
> http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>
> > wrote:
>
>>
>> What I am trying to get at is that PHP uses processes(Heavy weight) and
>> ASP.NET  uses threads which are light weight. So it
>> inflicts less strain upon the web server. So I am trying to solve the
>> problem of the strain that PHP causes on ther server.
>> --- On *Wed, 5/27/09, Eddie Drapkin 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>
>> >* wrote:
>>
>>
>> From: Eddie Drapkin 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>
>> >
>> Subject: Re: [PHP-DEV] PHP scalability problem
>> To: "tRace DOliveira" 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>
>> >
>> Cc: "PHP General Mailing List" 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=php-gene...@lists.php.net>
>> >
>> Date: Wednesday, May 27, 2009, 3:39 AM
>>
>>
>>
>> I seriously doubt it.  PHP is a better language in almost all regards and
>> is much much more popular.  A lot of people make that decision every day and
>> I'd say most of them choose PHP.  Why ask that, though?
>>
>> On Tue, May 26, 2009 at 11:36 PM, tRace DOliveira 
>> http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>
>> > wrote:
>>
>>>
>>> Do you agree with me that when building a large web application that
>>> people would rather choose ASP.Net over PHP if people had to choose between
>>> those two ?
>>> --- On *Wed, 5/27/09, Eddie Drapkin 
>>> http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>
>>> >* wrote:
>>>
>>>
>>> From: Eddie Drapkin 
>>> http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>
>>> >
>>> Subject: Re: [PHP-DEV] PHP scalability problem
>>> To: "Michael Shadle" 
>>> http://us.mc1104.mail.yahoo.com/mc/compose?to=mike...@gmail.com>
>>> >
>>> Cc: "tRace DOliveira" 
>>> http://us.mc1104.mail.yahoo.com/mc/compose?to=married...@yahoo.com>>,
>>> "intern...@lists.php.net"
>>> http://us.mc1104.mail.yahoo.com/mc/compose?to=intern...@lists.php.net>
>>> >
>>> Date: Wednesday, May 27, 2009, 3:29 AM
>>>
>>>
>>> nginx and php-fpm is the fastest setup I could find, after spending
>>> almost 2 weeks trying different combinations.
>>>
>>> Apache pre-fork model: 1900 reqs/second (this is with running queries per
>>> pageload)
>>> nginx w/ fpm: 3400 reqs/second
>>>
>>> And nginx's doc setup is awesome.
>>>
>>> Like Michael said, scaling PHP itself is no big deal, just add more
>>> worker nodes to your process pool, the issue is scaling out your sql server
>>> (memcache scaling is piss easy too)
>>>
>>> On Tue, May 26, 2009 at 11:24 PM, Michael Shadle 
>>> http://us.mc1104.mail.yahoo.com/mc/compose?to=mike...@gmail.com>
>>> > wrote:
>>>
 Succinct and great reply.

 Better webserver: nginx :)

 #3 is probably the most important piece.

 I'd like to also note scaling php is pretty simple. Scaling out
 typically provides better results as opposed to scaling up. Scaling your
 datastore will always be your pain point. Adding new data nodes is complex.
 Adding more php processing nodes is simple. Php nodes are just worker bees.
 They're great for shared-nothing processing engines.

 I can't think of a good metaphor right now other than that.

 On May 26, 2009, at 7:55 PM, Eddie Drapkin 
 http://us.mc1104.mail.yahoo.com/mc/compose?to=oorza...@gmail.com>>
 wrote:

  1) PHP is Rarely The Bottleneck:
> http://talks.php.net/show/drupal08/<
> http://talks.php.net/show/drupal08/7>
>
> 2) Invest in an opcode cache
> 3) DB I/O is always the most restrictive part of your application, read
> the
> mysql performance blog (a lot applies for postgres too)
> 4) If you're serious about scalability, ditch apache and use a better
> webserver

Re: [PHP] PHP scalability problem

2009-05-26 Thread Per Jessen
tRace DOliveira wrote:

> What I am trying to achieve is to have the server do less processing.
> Like I said PHP is a server side scripting language and each time a
> request is made a process is spawned and processes are heavy weight as
> compared to a thread which is a light weight process. 

On Linux, processes and threads have the same "weight". 

> So I want to take away much processing away from the server and have
> the client do it instead. Because if many requests are made the server
> will eventually go down because it will over the server. 

Get more servers. (or a bigger server).

> I am not trying to 
> get away from PHP but I am trying to solve the problem of scalability

As long as you can add hardware and gain more throughpout, your solution
scales.  If you add more hardware without any significant increases in
throughput, you've got a scalability problem.


/Per

-- 
Per Jessen, Zürich (10.8°C)


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