3 ms·
You've heard of PHP SAPIs right? You can most defiantly use PHP outside of a "web environment". I have PHP daemons managing the sending of email and sms, and
by xd 14y ago
You've heard of PHP SAPIs right? You can most defiantly use PHP outside of a "web environment". I have PHP daemons managing the sending of email and sms, and another used to manage incoming data that is fed into our local database. These have all ran for years (7+) with no issues.
- einhverfr 14y agoI have used it for all kinds of things. However your code is still embedded in SGML output ;-)
- xd 14y agoErm, no it is not.
- Shish2k 14y agoYour code doesn't start with a "<?php" tag?
- xd 14y agoWhat does that have to do with SGML?
- einhverfr 14y agoIt's the opening of an SGML process instruction tag. That's why PHP code is inherently embedded in SGML documents...... That's why the LedgerSMB project uses Template Toolkit with <?lsmb ?> tags (that and [% %] causes problems in LaTeX).
- xd 14y agoYou seem to think you have some understanding of PHP which you blatantly do not. You've made a nonsense assumption based on the choice of tag used by PHP to tell the interpretor to treat the text following the tag as code and not to direct it back out the SAPI.
- einhverfr 14y agoUmmm... I think you are missing my point. <html> <body> <?mypitag ... ?> </body> </html> That's an SGML document. It doesn't matter where the PI tag is, or what is in it, it's an SGML document. <?printstuff '<html> <body> <p>fun stuff here</p> </body> </html>' ?> That's still an SGML document. <?php # logic goes here ?> That's an SGML document. This is not splitting hairs. The reason is relatively subtle.... When you are doing SGML stuff an extra newline or a space in front of the opening tag really doesn't have any effect but if you do any output in binary form, it's a mess.
- xd 14y agoYou are making little to no sense. Sorry, but I've got to give up on this thread.
- einhverfr 14y agoYou are looking at it from the interpreter's perspective. I am looking at it from a document semantics perspective and what this means for more complex application environments. Let me give you an example. Suppose I have a GUI application that prints some XML fragments to standard output. The most natural way to do this in PHP is to write an XML pre-processor which happens to make decisions based upon operations in the GUI. In other languages you would print to standard output explicitly and the GUI would be primary. In PHP the XML output would be primary and the GUI would be secondary. In fact your entire GUI is sort of contained in XML fragments to start with.
- gnuvince 14y ago7 years? Really? Cause resource ids in PHP are not recycled, and I figure that at some point during those 7 years, you'd have opened enough connections, files and database handlers that you'd reach the limit of integers and PHP would just abort.
- xd 14y agoHah! Yeah, sorry I should have worded that better. They have been restarted as servers have been upgraded / restarted.
- soc88 14y agoYes, the daemon. The actual interpreter is still thrown away every few requests, because it is leaking memory like hell.
- xd 14y ago"Yes, the daemon. The actual interpreter is still thrown away every few requests, because it is leaking memory like hell." I'm talking about the CLI SAPI, NOT the Apache SAPI.