[PHP] Re: PHP Frameworks

2005-12-27 Thread Petr Smith

Simon Reye wrote:
I'm moving away from Cold Fusion and am considering java or php.  I've 
mucked around with Struts and Coccoon on the java side and think they 
are great.  There does not however seem to be any well backed projects 
similar to these for php.


Can anyone point me to a good php MVC framework?



What about http://www.symfony-project.com/ ?? Anyone using it?

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



[PHP] Re: Two version of PHP in single server

2005-11-29 Thread Petr Smith
Run two Apache servers, second (with old PHP version) on another port. 
Internally forward all requests to old PHP project to this second server.


We tested most methods but this was the best.

Petr

J.F.Kishor wrote:

Hi,

Thanks...!

Even the second is server-parsed not cgi

Some   more  suggestions   are  welcomed,   so  we   can   succeed  in
experimentation of Two version of PHP in same server.





i haven't tried this since php3/4, but it used to be that you could
install them both (as server parsed, not one as a cgi) and then use
different file extensions (and appropriate apache entries) to direct
which php version parsed the page. e.g., we used ".php3" to use the
php3 install and ".php" for php4.

i have a sense that this may be harder (or potentially impossible)
now, but you may want to look at the apache install documentation to
see if it gives hints. there used to be information in, i believe,
the apache source install documentation explaining how to do this.

as someone else has indicated, you can (or at least should be able
to) install one version as server-parsed and the second as cgi,
though that may not meet your needs.


 Original Message 


Date: Monday, November 28, 2005 12:07:02 PM +0530
From: "J.F.Kishor" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Subject: [PHP] Two version of PHP in single server

Hi,

I have  a query, can we run  two versions of PHP  in linux 7.2
server.

I want  to use PHP 4.x  for one application and  PHP 5.1.0 for
another application in the same server.

Do  I need to  do some  configuration changes  to set  the php
path. To  look up different  versions based on the  request of
the application.



Regards,
- JFK
kishor
Nilgiri Networks

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


-- End Original Message --






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



[PHP] Re: PhpMailer vs Pear:Mail

2005-11-28 Thread Petr Smith

Cabbar Duzayak wrote:

Could you please tell which one you recommend in terms of
stability/speed and share your experience in terms of these 2?

Thanks...



I tried all and ended with http://www.phpguru.org/static/htmlMimeMail5.html

fast, stable, usable.

Petr

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



[PHP] Re: PHP and email

2005-11-23 Thread Petr Smith
Thanks to those who have replied so far, yes our main concern is the 
smtp server falling over or dying. So to come back to John 
Nichel's answer:


 John, have you done this personally and I assume the effects were 
good?? IE everything ran smoothly?



I have done it just as John has described above, though I didn't have 8000
to send.  All went well, no hiccups.  A couple of things I would mention is
that I seem to remember reading somewhere that the sleep() function on
Windows eats a lot of processor.  Not an issue for me since I'm on Linux,
but worth a mention.  And the function John suggested above will take over
22 hours to send 8000 emails.  Since you say its a one shot deal, its
probably OK.



I don't think the long running script with sleep function is the best 
approach to this problem. I would recommend writing the whole queue 
somewhere (to database) and run script every 5 minutes, load some not 
sent yet e-mails (100), send them and write info (it_was_sent tag) back 
to database.


It's always better to not have long running script, you never know what 
can go wrong and if it fails somewhere or process is killed or machine 
rebooted or something happens, you don't know which emails were sent and 
which not. And there's no stupidest thing as sending the same company 
newsletter twice to the same client.


Petr

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



[PHP] Re: SOAP and PHP

2005-11-16 Thread Petr Smith

Torgny Bjers wrote:

Angelo Zanetti wrote:



Hi guys.

I've googled but found so many pages that I'm not sure what to use.

I want to use PHP to make use of SOAP.

I've found:
-nuSoap
-libxml(2)
-php-soap
-and others which seemed less important.

Can you recommend which one to use? and which one is the most supported.
Also if I've missed some that you feel I should know about please let
me know.
Thanks in advance.

Angelo




Not sure, but there's already a couple of relevant classes in PEAR:
http://pear.php.net/search.php?q=soap&in=packages&x=0&y=0

A hot tip is to always search in the packages there. :)
http://pear.php.net/packages.php

Warm Regards,
Torgny



Who uses PEAR? Mess of old unsupported and undocumented libraries which 
only their authors (maybe) can use?


I would recommend PHP5 SOAP extension, based on libxml2. It works 
without problems and without messing with PEAR.


You can start with this tutorial: 
http://www-128.ibm.com/developerworks/library/os-phpws/?ca=dgr-lnxw06PHP5soap


Petr

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



Re: [PHP] PHP Search Engine

2005-11-09 Thread Petr Smith

It sounds like this is specifically for html pages, or am I assuming wrong?
Do any of these or other search engines index html content held in a MySQL
database?

Arno


It depends.. Some products are based around web spider (mnogosearch), 
some are only engines without spider part (lucene).


There are ways to add web spider to engine (nutch for lucene) or use 
only engine part of web spider (you can always generate local content 
[file structure] from database, it's not very clever but it works).


So the answer is yes, you can always index MySQL content somehow.

Petr

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



Re: [PHP] PHP Search Engine

2005-11-09 Thread Petr Smith

Richard Lynch wrote:

On Tue, November 8, 2005 11:20 pm, Leonard Burton wrote:


Has anyone on here created a search engine in PHP?



Sure, of sorts, now and again, here and there, to some degree.




I am reasonably certain that if you Googled for:
"PHP web spider framework"
you would find several packages that would have at least 99% of what
you need...  Because these simply have to exist out there.



From you description it seems like writing search engine (full text) is 
simple task for three or four nights. It's not true.


Writing quality full text search engine is very complex task and you can 
stuck at lots of problems. If you don't understand the theory of text 
searching, you can finish it somehow, but it will not search the way 
people are used to. The results will be wrong.


You think there have to be something written in PHP. There is not. Lots 
of dead experiments - yes. Something good, working and in active 
developement - no. There is even not much open source search engines 
written in other languages. You just cannot stick to PHP - but it 
doesn't matter in which language is the spider. You need only some 
interface to the search part.


Here's my list:

mysql fulltext - toy for children
phpdig - lots of little problems here and there, unusable
htdig - dead, buggy
swish-e - dead?
swish++ - one man show?
aspseek - dead
mnogosearch - try it, it's not google, but usable, php interface
lucene - top quality, best query syntax
egothor - people says it's usable

did I forgot something good?

Petr

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



[PHP] Re: php5 / php4 - MySQL/SQLite

2005-11-08 Thread Petr Smith

Danny wrote:

Hi,
 Let me open a discussion about php5 / php4
 Why upgrade? It worth? Benefits? Code programming changes?
 Is there and end-of-life for php4, in the near/medium future?
 What about MySQL and SQLite. What is the future of both? I would like to
open a discussion about the future of both related to php no matter the
version of it...
Let´s start
--
dpc



Why don't you use Windows 3.1? It's mostly good idea to install new 
version of software when it's available. Bug fixes, improvements, new 
ideas. It's the same with PHP. Why to annoy with php4 if there's new, 
stable, working, better php5 (php5.1!)? I would use PHP5 just for 
"file_put_contents" function :). There is no reason to stay with PHP4 so 
why to talk about it? Yes, we can discuss if it's worth to move to java 
or .net or ruby or python, it could be interesting discussion, but I 
think it's waste of time to discuss php4/5 differences.


Similar problem is with your second question. What can I say about 
future of MySQL and SQLite related to php? Both could be used with php 
and you should select which one to use according to your needs. There 
are other databases too...


Again - I don't know what are you expecting from these two questions. 
They cannot be discussed at all.


Petr

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



[PHP] Re: Template style question

2005-11-06 Thread Petr Smith
Smarty sucks. Mixing presentation and logic is never good idea. I know 
Smarty is very popular, but big popularity doesn't always mean quality.


Back to original question: If you decided to reinvent the wheel, please 
don't reinvent square wheel without tire.


Mixing presentation and logic is bad. You should have no sqls, loops, 
ifs or any other logic things in templates. Templates should be editable 
by any stupid guy, anyone who knows just css/html. No sql, no php, no 
other language.


Back to original idea to parse table. Do not copy bad ideas from other 
templating engines. Again - reinvent a better wheel or use some from 
1000s of existing libraries. Download some existing libraries, think 
about good and bad things, make it better, make it different! Otherwise 
we will end with 1000+1 stupid, same, useless templating libraries.


Petr

James Benson wrote:

Give smarty a try rather than re-inventing the wheel


http://smarty.php.net



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



[PHP] Re: curious (and frustrating) php/apache behavior

2005-10-29 Thread Petr Smith

Hi,

why don't you use normal php include (require) functions? Why do you 
want to mix apache server side includes with php code? There is nothing 
php include can't do..


Just change all



to



Petr

Don Brown wrote:

We're having a problem getting more than one imbedded PHP script to execute in 
our Apache-served pages. We're using Apache 2.0.40 server-side includes. We 
wish to include multiple PHP scripts into our pages but are only succeeding in 
having the first included PHP script executed; the rest are ignored or 
misinterpreted as HTML...

Thank you in advance for any help you provide.


This works:

$ cat php1.txt

$ cat test.shtml




this came from html



Producing the expected result from the browser (http://myhost/test.shtml):
this is the first php include 
this is html 


However, this does not produce the expected three line result:

$ cat php1.txt

$ cat php2.txt

$ cat test.shtml




this came from html





Producing from the browser (http://myhost/test.shtml):
this is the first php include 
this is html 



This DOES work:

$cat test.php





this is from html






Producing from the browser (http://myhost/test.shtml):
this is from the first php block 
this is from html 
this is from the second php block 



Don Brown
Co-Founder, Utah Skies
"Ski champagne powder by day, surf diamond-studded velvet by night..."



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



[PHP] Re: fopen

2005-10-26 Thread Petr Smith

Hi,

yes, there could be some problem with your code. But it depends on what 
are you trying to archieve.


If you are trying to put whole file to database, there is no reason to 
use fgets function. Just use $buffer=file_get_contents($filename); and 
put the buffer into SQL. No reason to read it line by line using fgets. 
The whole file will end in memory in the SQL section, so it doesn't 
matter ho you read it.


If you want to process huge file line by line, it's really good idea to 
not put whole file to memory (using file_get_contents) but to read it 
line by line using fgets, process every line and forgot it. The file 
could be very large and you still need only very small memory amount. 
And there can be problem you are saying.


What if there is some line longer than 4096 bytes (or some bigger 
limit)?? You can solve it simply using code like this:


$dataFile = fopen( $filename, "r" ) ;
$buffer = "";
while (!feof($dataFile)) {
$buffer .= fgets($dataFile, 4096);
if (strstr($buffer, "\n") === false && !feof($dataFile)) {
// long line
continue;
}   
echo $buffer;
$buffer = "";
}

Petr

John Taylor-Johnston wrote:
It does what I want, but I worry 4096 may not be big enough. Possible? 
Is there a way to detect the filesize and insert a value for 4096?

$buffer = fgets($dataFile, $filesize);
Is this what it is for?
John


http://ca3.php.net/fopen
$filename = "/var/www/html2/assets/about.htm" ;
$dataFile = fopen( $filename, "r" ) ;
  while (!feof($dataFile))
  {
  $buffer = fgets($dataFile, 4096);
  echo $buffer;
  }
$sql = "insert into table ... $buffer";
?>


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



Re: [PHP] php 5.0.5 segfaults apache2 on ubuntu, 5.0.4 ok

2005-10-25 Thread Petr Smith

I just found this is known bug and was already fixed in CVS.

http://bugs.php.net/bug.php?id=34450&edit=2

thanks to all!

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



Re: [PHP] php 5.0.5 segfaults apache2 on ubuntu, 5.0.4 ok

2005-10-21 Thread Petr Smith

Hi,

thanks! that was it! when destruct method is removed, all problems are 
gone.


I really don't know why I added the __destruct method to this mysql 
wrapper. Maybe I saw it somewhere in discussion at php manual bottom


This code segfaults my apache:

close();
}
}

$obj = new test();

?>

Accessing this page means immeadiate apacha segfault and actual 
connection close. Anybody please test this on 5.0.5 and verify if it's 
reproducible.


Petr


I think this could be related to your _destruct method
Can't you just rely on the parent class destruct method?
Sorry to be a bit vague, I'll look into it a little further.


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



[PHP] php 5.0.5 segfaults apache2 on ubuntu, 5.0.4 ok

2005-10-20 Thread Petr Smith

Hi,

I've just installed php 5.0.5 to newest ubuntu breezy and apache2
started (sometimes) segfaulting (teste two computers with ubuntu hoary
and ubuntu breezy - same results).

Is says something like this:

[Thu Oct 20 12:32:21 2005] [notice] child pid 13161 exit signal
Segmentation fault (11)
[Thu Oct 20 12:32:21 2005] [notice] child pid 13191 exit signal
Segmentation fault (11)

Apache2 is breezy version Server version: Apache/2.0.54
Server built:   Oct  4 2005 07:42:46

It does this only in some applications (for example phpMyAdmin works ok)
 but PHP 5.0.4 worked ok. I tried to isolate some code which do the
segfaults but withou big success.

This code could be involved.. I don't know. It works sometimes,
sometimes not.


this line maybe?: parent::__construct($config['host'],
$config['username'], $config['password'], $config['db']);


class MySQL extends mysqli {
static function &getInstance($configuration) {
static $dbObj = null;

if (is_null($dbObj)) {
$dbObj = new Mysql($configuration);
}
return $dbObj;
}

function __construct($configuration) {
$config = $configuration->getDbConfig();

try {
parent::__construct($config['host'], 
$config['username'],
$config['password'], $config['db']);
} catch (WarningException $we) {
if (mysqli_connect_error()){
throw new DBConnectException(mysqli_connect_error(),
mysqli_connect_errno());
}
}   
parent::query("SET NAMES 'utf8'");
}

   function __destruct() {
@$this->close(); 
   }

function query($query) {
if (($result = parent::query($query)) != false) {
if (eregi("^select", $query)) {
return new QueryResult($result);
} else {
return new QueryResult(false, 
$this->affected_rows);
}
} else {
throw new SQLException($this->error, $this->errno, 
$query);
}
}

function getInsertId() {
return $this->insert_id;
}
}



I think this is some new bug in 5.0.5 version and I want to help to fix
it. But I don't know how. What should I do?

Thanks,

Petr

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



[PHP] Re: PHP DOM XHTML - let me set my own javascript from code

2005-10-19 Thread Petr Smith

Thanks a lot Rob, it's so simple! I don't know why I did't find it myself.

Petr

Rob wrote:

Petr Smith wrote:


but it encloses it to CDATA section automatically like this:

<tt>language="Javascript"><![CDATA[alert('ddd');]]>


but I need it like this (because otherwise the javascript don't work):


//<![CDATA[
alert('ddd');
//]]>




First, script was using some bogus method names.
Secondly, you try to do anything like the following (which do work)?

$html = "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\n".

"\n".
"http://www.w3.org/1999/xhtml\"; xml:lang=\"en\" 
lang=\"en\">\n".

"\n" .
"\n" .
"\n" .
"hello\n" .
"\n" .
"";
$dom = new DomDocument();
$dom->preserveWhiteSpace = true;
$dom->loadXML($html);
$params = $dom->getElementsByTagName('script');
foreach ($params as $param) {
$dat = $dom->createTextNode("\n//");
$param->appendChild($dat);
$dat  = $dom->createCDATASection("\n\nalert('ddd');\n\n//");
$param->appendChild($dat);
$dat = $dom->createTextNode("\n");
$param->appendChild($dat);
}
echo $dom->saveXML();

Could also do it using  through a comment node (following adds 
some linefeeds too):

foreach ($params as $param) {
$dat = $dom->createTextNode("\n");
$param->appendChild($dat);
$dat  = $dom->createComment("\n\nalert('ddd');\n\n");
$param->appendChild($dat);
$dat = $dom->createTextNode("\n");
$param->appendChild($dat);
}


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



[PHP] PHP DOM XHTML - let me set my own javascript from code

2005-10-18 Thread Petr Smith

Hi,

I have problem with PHP DOM extension. How can I add my own javascript 
to javascript tag?


I tried it using this code

$html = "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\";>\n" .

"\n" .
"http://www.w3.org/1999/xhtml\"; xml:lang=\"en\" 
lang=\"en\">\n" .

 "\n" .
"\n" .
"\n" .
"hello\n" .
"\n" .
"";
$dom = new DomDocument();
$dom->preserveWhiteSpace = true;
$dom->loadXML($html);
$params = $dom->getElementsByTagName('script');
foreach ($params as $param) {
  $dat  = $dom->createTextSection("\n\nalert('ddd');\n\n");
$param->appendChild($dat);

}
echo $dom->saveXML();

but it encloses it to CDATA section automatically like this:

language="Javascript">


but I need it like this (because otherwise the javascript don't work):


//


Thanks for any idea,

Petr

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



Re: [PHP] caching parsed XML files as DOM objects in memory


I'm writing template
library based on XML. But it's not very efficient to create new
DomDocument, load XML template, process it and show on every page hit.
XML parsing is not very fast, and because I'm parsing XHTML with
entities, all DTD's are parsed too. I thought about something similar
to
java - there I can have servlet which lives all the time the server
lives. It can load XML and parse it only for the first time and send
DOM
objects to another servlets.
I need something similar with PHP, can it be done?



I think you might want to avoid trying to do it the Java way in PHP.

PHP is share-none by architectural design, not accident, so that you
can scale up by throwing as much cheap/stock hardware at it as you can
afford instead of being forced to buy a single bigger hardware box in
the center for the shared data.

It would probably make a lot more sense to store whatever you use to
uniquely identify your XML source and the results in a database or
filesystem, and then compare time-stamps in some simple business logic
to decide to re-parse or serve from cache.

Yes, that does just foist off the shared-data to the database, or
file-system -- but those systems are specifically designed to handle
this task for a long time now with a lot of heavily tested and
optimized code.  PHP and even Java can't really match that level of
testing/optimization yet simply due to relative ages.

If db and filesystem are "too slow" or you already have too many
machines running this code-base, you could write your own PHP "XML
cache server" that takes an XML id and either gets it from the db/file
cache, or parses the true original, and set up your own "server" for
this express purpose and really make it scream on speed...  That's
quite a bit of work, though, and for the simplicity of the code
involved, you may be better off writing it as a C application... Or
out-sourcing that bit of code to be written with specific timing
targets for the employee to meet/beat to get their just due $$$.



Thanks for lot of ideas, you are probably right I'm trying to think it 
the "java way".
But my main bottleneck is the XML parsing part, so I was trying to avoid 
it somehow. It is also more slower because my XML is not "normal" XML, 
but XHTML file so I need to have resolveExternals=true to parse files 
with XHTML entities (  < etc.)
So I cannot cache my final objects to files or database, because it 
involves some sort of serialization and later (when accessing the cache) 
some unserialization (the slow parse part).

That was the reason I thought about caching in memory.
I'm sure I can setup some "XML cache server" but again, how will I 
exchange data with it? I cannot move all object trees between servers 
(XML files couldn't be serialized).
There is last chance to write some C extension, but why use PHP then? I 
can write it all in C, also with my own HTTP server :)
I think there should be some way to have all objects (including PHP 
internal) stored somewhere in memory and "living" all the time the web 
server lives. It solves many types of problems.


Petr

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



[PHP] Re: ob_start and ob_get_contents buffering problem


Dasdan wrote:

question:
I try to buffer the output of the 'system/views/main.php' into $contents.
and then do a print.
Problem is that the contents of the system/views/main.php are printed 2
times.
Someone who can explain me?
following the contents of testfile.php and main.php, php.ini settings
concerning ob_ ... functions and the output of the script.


Hi,

you have to use



because include goes to buffer, print's go to buffer and on the end the 
buffer is automatically flushed out. So it's the 2x - once for include, 
once for "print $contents"


Simple eh?

Petr

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



[PHP] Re: How do I POST data with headers & make the browser follow?


I have to apologize if this issue has been discussed in detail before but I
couldn't find anything obvious so far.

What I need/want to do is to :

1. Take POST data from a form (no problem)
2. Do whatever i need to on the target page (no problem)
3. Pass some other data on to a 3rd page as a POST
   request.
4. Get the browser to follow to said 3rd page.


All this is happening via SSL.

So basically what i am trying to do is to "fake" whatever happens
at a normal POST request that is handled by the browser.

Now point 4. in my example above is giving me a massive headache,
I have managed to pass data on to the 3rd page as POST quite comfortably
using cURL but the browser doesn't follow (ie. the URL in the address bar
remains unchanged).

I did see that there is a FOLLOWLOCATION option you can set in cURL when you
do you request, and though "wicked, just what I needed" only to find out
that it's not working (probably because I understand what it does wrong).

Pretty pretty please if anyone knows a solution for the above, let me know. 


Oh, and I'd also like to add that the information I am trying to get to the
3rd page in the example is sensitive (Credit Card details etc.), so $_GET
and $_COOKIE are out of the question.


Hi,

it seems you have no understanding how http protocol works.. I can't 
learn you the whole thing, but I can give you some hints. Read something 
about HTTP 
(http://www.digital-web.com/articles/powering_the_web_with_http/), 
install some network sniffer (ethereal, HttpWatch for IE - great tool 
for beginners) and see what happens.


- you cannot force browser to POST something somewhere with PHP. You 
have to realize, that PHP is running on server, but the browser is the 
client.
- you cannot use curl to do it. With curl it all happens on the server. 
If you want to use curl, you have to use same technique used by "web 
based anonymous proxy". Return all loaded data to client, rewrite urls 
to your script, handle everything correctly until client closes browser. 
Very complex stuff
- followlocation has nothing to do with browser. it only says to curl to 
evaluate Location header and do auto-redirection

- sensitive information? GET, POST, COOKIE, everything could be intercepted
- your only help is javascript. You can generate something like this to 
client browser with php. But you couldn't hide sensitive information 
this way.





- think about your problem and possible solutions again

Petr

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



Re: [PHP] caching parsed XML files as DOM objects in memory

it's not working at all. And it could never work. I don't think it's 
funny to write false advices to people "every other week".
I've installed APC cache, tried to save XML. It was not working. 
apc_fetch returned NULL every time.

[snip]

When I looked into documentation for APC - there is this sentence: 
"And apc_store() currently doesn't work at all for (internal) classes 
in PHP5 right now.". And all the XML stuff is what? Internal PHP5 
classes!


I can only apologise for your wasted time -- I seem to remember it 
working but may have been caching a different class; it was a while ago.


Perhaps Rasmus or someone with more knowledge of APC internals could 
comment? I find APC very useful but it would be extremely useful to be 
able to cache the DOMDocument class.


Could you please post the link to the docs from which you got that 
quote? I cannot find any words to that effect on either the php.net or 
pecl.php.net websites, but maybe I'm not looking hard enough...




Apology accepted. Sorry for my (maybe) too offensive language, I was 
disappointed it's not working.


This quote is from TODO "Known Bugs" file inside apc distribution 
archive (v3.0.8).


Petr

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



Re: [PHP] caching parsed XML files... FALSE advice, still not working


Petr Smith wrote:

Jasper Bryant-Greene wrote:


Petr Smith wrote:

is it possible to cache parsed XML files somehow? I'm writing 
template library based on XML. But it's not very efficient to create 
new DomDocument, load XML template, process it and show on every page 
hit. XML parsing is not very fast, and because I'm parsing XHTML with 
entities, all DTD's are parsed too. I thought about something similar 
to java - there I can have servlet which lives all the time the 
server lives. It can load XML and parse it only for the first time 
and send DOM objects to another servlets.

I need something similar with PHP, can it be done?




This question seems to come up every other week on this list. Have a 
look at APC[1]; you can cache objects with its apc_store() and 
apc_fetch() functions.


[1] http://php.net/apc



Thanks, looks usable.. I hope it can synchronize successfully between 
different calls on heave load. I'll try it, I don't know why I missed it 
when browsing documentation.


Petr


Hi,

it's not working at all. And it could never work. I don't think it's 
funny to write false advices to people "every other week".
I've installed APC cache, tried to save XML. It was not working. 
apc_fetch returned NULL every time.


$dom = apc_fetch("dom");
if ($dom === false) {
$dom = new DomDocument();
$dom->load("browsers.html");   
$store = apc_store("dom", $dom);
echo "store finished: $store";
}
echo $dom->saveXML();

When I looked into documentation for APC - there is this sentence: "And 
apc_store() currently doesn't work at all for (internal) classes in PHP5 
right now.". And all the XML stuff is what? Internal PHP5 classes!


Please don't confuse people with false edvices next time. Better to say 
nothing then solutions that are not working. I lost lot of time and got 
only ton of disapointment.


And still no solution to my problem :(.

Petr

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



Re: [PHP] caching parsed XML files as DOM objects in memory


Jasper Bryant-Greene wrote:

Petr Smith wrote:

is it possible to cache parsed XML files somehow? I'm writing template 
library based on XML. But it's not very efficient to create new 
DomDocument, load XML template, process it and show on every page hit. 
XML parsing is not very fast, and because I'm parsing XHTML with 
entities, all DTD's are parsed too. I thought about something similar 
to java - there I can have servlet which lives all the time the server 
lives. It can load XML and parse it only for the first time and send 
DOM objects to another servlets.

I need something similar with PHP, can it be done?



This question seems to come up every other week on this list. Have a 
look at APC[1]; you can cache objects with its apc_store() and 
apc_fetch() functions.


[1] http://php.net/apc


Thanks, looks usable.. I hope it can synchronize successfully between 
different calls on heave load. I'll try it, I don't know why I missed it 
when browsing documentation.


Petr

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



[PHP] caching parsed XML files as DOM objects in memory


Hi,

is it possible to cache parsed XML files somehow? I'm writing template 
library based on XML. But it's not very efficient to create new 
DomDocument, load XML template, process it and show on every page hit. 
XML parsing is not very fast, and because I'm parsing XHTML with 
entities, all DTD's are parsed too. I thought about something similar to 
java - there I can have servlet which lives all the time the server 
lives. It can load XML and parse it only for the first time and send DOM 
objects to another servlets.

I need something similar with PHP, can it be done?

Thanks for any ideas,

Petr

ps. I found this project http://www.vl-srm.net/ which maybe can do 
something I need, but it looks dead.


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