php-general Digest 27 Sep 2012 09:31:36 -0000 Issue 7982
php-general Digest 27 Sep 2012 09:31:36 - Issue 7982 Topics (messages 319268 through 319275): Static constructor support 319268 by: Yves Goergen 319269 by: Stuart Dallas 319270 by: Yves Goergen 319271 by: Stuart Dallas 319272 by: Yves Goergen 319273 by: Sebastian Krebs 319274 by: Sebastian Krebs about lock some codes. 319275 by: lx Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Hi, I couldn't find out whether PHP supports static constructors, and how the syntax is. The web and the PHP manual don't mention it. So is it not supported? If it is, is there a PHP version restriction? -- Yves Goergen - nospam.l...@unclassified.de - http://unclassified.de ---End Message--- ---BeginMessage--- On 26 Sep 2012, at 22:13, Yves Goergen nospam.l...@unclassified.de wrote: I couldn't find out whether PHP supports static constructors, and how the syntax is. The web and the PHP manual don't mention it. So is it not supported? If it is, is there a PHP version restriction? If you mean what C# calls a static constructor, no that does not exist in PHP, but you can fake it. Make sure the class is in it's own file, and you can initialise it like so… ?php MyStaticClass::init(); class MyStaticClass { static public function init() { // Do initialisation here } } Then, when the class file is required the initialisation method will automatically be executed. However, I wouldn't encourage you to use static classes like this. The singleton pattern would be my recommendation. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/---End Message--- ---BeginMessage--- On 26.09.2012 23:20 CE(S)T, Stuart Dallas wrote: If you mean what C# calls a static constructor, no that does not exist in PHP, but you can fake it. Okay, thank you for the quick info. How do other languages than C# call that? :-) My class is a debug helper class, that can write trace messages and so on. I have added a random per-request tag to distinguish concurrent requests in the trace file and thought that generating such a tag would perfectly fit in a static constructor. Now a helper function does that check and generates one on the first call of the method. -- Yves Goergen - nospam.l...@unclassified.de - http://unclassified.de ---End Message--- ---BeginMessage--- On 26 Sep 2012, at 22:29, Yves Goergen nospam.l...@unclassified.de wrote: On 26.09.2012 23:20 CE(S)T, Stuart Dallas wrote: If you mean what C# calls a static constructor, no that does not exist in PHP, but you can fake it. Okay, thank you for the quick info. How do other languages than C# call that? :-) They generally don't. C# is the only language I've ever come across that support such a thing, and I only found that by accident because it would never occur to me to look for it. My class is a debug helper class, that can write trace messages and so on. I have added a random per-request tag to distinguish concurrent requests in the trace file and thought that generating such a tag would perfectly fit in a static constructor. Now a helper function does that check and generates one on the first call of the method. I would strongly recommend a singleton, or if you must use a static class you can either use the initialisation mechanism I described or, if the class has a single method as I'm guessing, have that method check the static variable to see if it's been set yet, and if not generate it before doing anything else. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/---End Message--- ---BeginMessage--- On 26.09.2012 23:38 CE(S)T, Stuart Dallas wrote: On 26 Sep 2012, at 22:29, Yves Goergen nospam.l...@unclassified.de wrote: My class is a debug helper class, that can write trace messages and so on. I have added a random per-request tag to distinguish concurrent requests in the trace file and thought that generating such a tag would perfectly fit in a static constructor. Now a helper function does that check and generates one on the first call of the method. I would strongly recommend a singleton, or if you must use a static class you can either use the initialisation mechanism I described or, if the class has a single method as I'm guessing, have that method check the static variable to see if it's been set yet, and if not generate it before doing anything else. Why does everybody seem to recommend singletons so strongly? What's wrong with static classes? Are they considered as global variables, the most evil remainder from the Middle Age? What is easier to call on a regular hacky basis: XyzDebug::Trace(...); or XyzDebug::GetInstance()-Trace(...); I
php-general Digest 27 Sep 2012 23:33:24 -0000 Issue 7983
php-general Digest 27 Sep 2012 23:33:24 - Issue 7983 Topics (messages 319276 through 319288): Re: PHP as Application Server 319276 by: Maciej Li¿ewski 319278 by: Alessandro Pellizzari 319279 by: Sebastian Krebs Re: about lock some codes. 319277 by: Maciek Sokolewicz 319281 by: Jim Giner 319282 by: Maciek Sokolewicz Activating the mysql_clear_password plugin 319280 by: Pierre-Gildas MILLON Responding to an XML data post 319283 by: Bastien Koert 319284 by: Daniel Brown 319287 by: tamouse mailing lists Problem with PHP in Moodle LMS 319285 by: Gary Lebowitz 319286 by: admin Re: Static constructor support 319288 by: David Harkness Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- to Matijn Woudt: you are right there should be something like: public void synchronized increment(), but that is not the point. Sure there are disadvantages and other problems but what Alessando is saying is I would not use cure for cancer even if it existed because it can introduce other problems like overpopulation. There are cases when application server adds much overhead that is not needed and there are cases when it simplifies your tasks a lot. So from his mail the only problem I can see is memory leaks, and I am not talking about leaks in application because they can be caught in tests and fixed, but mostly leaks in poorly wriiten PHP core and modules. Other like session hijacking are not real problems (other languages somehow managed it to work) or not so big in face of some other advantages (like restarting application after change). Robert Williams points that the main problem is with PHP programmers who tend to ignore many aspects of multithreaded programming and PHP helps them in that by hiding all threading aspects. There are still people who can understand that and take profit from this knowlege. The memory is also not such problem. I did some quite large PHP projects and whole source code event if it were loaded in memory use only few megabytes (event 100mb is not a problem). And am talking about holding parsed structures in memory not the source files. Applications I am talking about are mostly targeted to maximize throughput and they are the only ones on server. In such cases *any* speed improvement is worth attention. I am not forcing anybody to use application server approach, but rather like Robert said - good to have choice and decide on my own if I want to write simple scripts or stateful application. The only problem is that I do not have that choice not considering changing language... at least I do not have such choice for now :) 2012/9/26 Robert Williams rewilli...@thesba.com: On 9/26/12 10:18, Matijn Woudt tijn...@gmail.com wrote: Writing scripts for an application server requires a much deeper understanding of threads and computer internals,so as a result it probably increases error rate. Well... yes and no. PHP's architecture pretty much keeps you from having to mess with thread management, but it does so by shifting the burden to a higher level, either process management of multiple PHP processes or thread management within the context of the HTTP server. If your application is sufficiently simple, that shift may be enough to keep you from having to worry about the problem. For most applications, however, it's still a concern. In some ways, this can make things worse, simply because PHP programmers tend to be oblivious of the potential problems, whereas the typical C# or Java programmer has at least some awareness of the various traps that await them. As an example, I see PHP code *all the time* that is wide open to concurrency issues with the database. Most code just assumes it's the only code doing updates, but unless the server is set up to serialize requests, that's an invalid assumption. Recently, more folks have started to address this by using database transactions, but this is often done in ignorance of what isolation level is being used and what the impact of that is upon the code - which can just make things worse. Even when there is that awareness, there are database concurrency issues with which transactions can't help. (Of course, people who are aware of isolation levels also tend to be aware of other concurrency issues.) The point is, if you have multiple things running in parallel, whether that be threads within your application or entirely separate physical servers running multiple copies of your application, you have to deal with concurrency issues. It's a necessary evil of parallel programming, and no mere technological solution (language,
Re: [PHP] Static constructor support
On 26.09.2012 23:38 CE(S)T, Stuart Dallas wrote: On 26 Sep 2012, at 22:29, Yves Goergen nospam.l...@unclassified.de wrote: My class is a debug helper class, that can write trace messages and so on. I have added a random per-request tag to distinguish concurrent requests in the trace file and thought that generating such a tag would perfectly fit in a static constructor. Now a helper function does that check and generates one on the first call of the method. I would strongly recommend a singleton, or if you must use a static class you can either use the initialisation mechanism I described or, if the class has a single method as I'm guessing, have that method check the static variable to see if it's been set yet, and if not generate it before doing anything else. Why does everybody seem to recommend singletons so strongly? What's wrong with static classes? Are they considered as global variables, the most evil remainder from the Middle Age? What is easier to call on a regular hacky basis: XyzDebug::Trace(...); or XyzDebug::GetInstance()-Trace(...); I really prefer the first one. I always use static classes when there is no real instance of something. Why should I force to act as if, only to follow some trendy pattern? -- Yves Goergen - nospam.l...@unclassified.de - http://unclassified.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Static constructor support
2012/9/27 Yves Goergen nospam.l...@unclassified.de On 26.09.2012 23:38 CE(S)T, Stuart Dallas wrote: On 26 Sep 2012, at 22:29, Yves Goergen nospam.l...@unclassified.de wrote: My class is a debug helper class, that can write trace messages and so on. I have added a random per-request tag to distinguish concurrent requests in the trace file and thought that generating such a tag would perfectly fit in a static constructor. Now a helper function does that check and generates one on the first call of the method. I would strongly recommend a singleton, or if you must use a static class you can either use the initialisation mechanism I described or, if the class has a single method as I'm guessing, have that method check the static variable to see if it's been set yet, and if not generate it before doing anything else. Why does everybody seem to recommend singletons so strongly? What's wrong with static classes? Are they considered as global variables, the most evil remainder from the Middle Age? What is easier to call on a regular hacky basis: XyzDebug::Trace(...); or XyzDebug::GetInstance()-Trace(...); Or just XyzDebug\trace(); Functions are not dead yet I really prefer the first one. I always use static classes when there is no real instance of something. Why should I force to act as if, only to follow some trendy pattern? -- Yves Goergen - nospam.l...@unclassified.de - http://unclassified.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- github.com/KingCrunch
Re: [PHP] Static constructor support
2012/9/26 Stuart Dallas stu...@3ft9.com On 26 Sep 2012, at 22:29, Yves Goergen nospam.l...@unclassified.de wrote: On 26.09.2012 23:20 CE(S)T, Stuart Dallas wrote: If you mean what C# calls a static constructor, no that does not exist in PHP, but you can fake it. Okay, thank you for the quick info. How do other languages than C# call that? :-) They generally don't. C# is the only language I've ever come across that support such a thing, and I only found that by accident because it would never occur to me to look for it. In java it's called a static block [1] public class myclass{ static{ //some statements here } } And a use-case is pseudo-constant expression like public class myclass{ public static $CONSTANT; static{ self::$CONSTANT = new DefaultFooBar; } } [1] http://www.erpgreat.com/java/use-of-a-static-block-in-a-class.htm My class is a debug helper class, that can write trace messages and so on. I have added a random per-request tag to distinguish concurrent requests in the trace file and thought that generating such a tag would perfectly fit in a static constructor. Now a helper function does that check and generates one on the first call of the method. I would strongly recommend a singleton, or if you must use a static class you can either use the initialisation mechanism I described or, if the class has a single method as I'm guessing, have that method check the static variable to see if it's been set yet, and if not generate it before doing anything else. -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- github.com/KingCrunch
[PHP] about lock some codes.
Hello: I have a question now.the code is: $ftemp = fopen($fdoc_tmp/temp_proxy, 'w'); fwrite($ftemp, $content); fclose($ftemp); exec(/usr/local/bin/gdnsproxy -a -f $fdoc_tmp/temp_proxy 1$fdoc_tmp/dout 2$fdoc_tmp/derr, $data, $ex_result); echo ret=.$ex_result; As you see, If a process run these,this is right.But two processes run this codes. the order maybe is: 1.process 1 create the temp_proxy1 2.process 2 create the temp_proxy2 3.process 1 exec temp_proxy2 4.process 2 exec temp_proxy2 The temp_proxy1 can't exec. So,I want to know how to solve it. Thank you.
Re: [PHP] Re: PHP as Application Server
to Matijn Woudt: you are right there should be something like: public void synchronized increment(), but that is not the point. Sure there are disadvantages and other problems but what Alessando is saying is I would not use cure for cancer even if it existed because it can introduce other problems like overpopulation. There are cases when application server adds much overhead that is not needed and there are cases when it simplifies your tasks a lot. So from his mail the only problem I can see is memory leaks, and I am not talking about leaks in application because they can be caught in tests and fixed, but mostly leaks in poorly wriiten PHP core and modules. Other like session hijacking are not real problems (other languages somehow managed it to work) or not so big in face of some other advantages (like restarting application after change). Robert Williams points that the main problem is with PHP programmers who tend to ignore many aspects of multithreaded programming and PHP helps them in that by hiding all threading aspects. There are still people who can understand that and take profit from this knowlege. The memory is also not such problem. I did some quite large PHP projects and whole source code event if it were loaded in memory use only few megabytes (event 100mb is not a problem). And am talking about holding parsed structures in memory not the source files. Applications I am talking about are mostly targeted to maximize throughput and they are the only ones on server. In such cases *any* speed improvement is worth attention. I am not forcing anybody to use application server approach, but rather like Robert said - good to have choice and decide on my own if I want to write simple scripts or stateful application. The only problem is that I do not have that choice not considering changing language... at least I do not have such choice for now :) 2012/9/26 Robert Williams rewilli...@thesba.com: On 9/26/12 10:18, Matijn Woudt tijn...@gmail.com wrote: Writing scripts for an application server requires a much deeper understanding of threads and computer internals,so as a result it probably increases error rate. Well... yes and no. PHP's architecture pretty much keeps you from having to mess with thread management, but it does so by shifting the burden to a higher level, either process management of multiple PHP processes or thread management within the context of the HTTP server. If your application is sufficiently simple, that shift may be enough to keep you from having to worry about the problem. For most applications, however, it's still a concern. In some ways, this can make things worse, simply because PHP programmers tend to be oblivious of the potential problems, whereas the typical C# or Java programmer has at least some awareness of the various traps that await them. As an example, I see PHP code *all the time* that is wide open to concurrency issues with the database. Most code just assumes it's the only code doing updates, but unless the server is set up to serialize requests, that's an invalid assumption. Recently, more folks have started to address this by using database transactions, but this is often done in ignorance of what isolation level is being used and what the impact of that is upon the code - which can just make things worse. Even when there is that awareness, there are database concurrency issues with which transactions can't help. (Of course, people who are aware of isolation levels also tend to be aware of other concurrency issues.) The point is, if you have multiple things running in parallel, whether that be threads within your application or entirely separate physical servers running multiple copies of your application, you have to deal with concurrency issues. It's a necessary evil of parallel programming, and no mere technological solution (language, database, whatever), now or in the future, can fully overcome it. Well, maybe an AI engine somewhere in the chain, but that's about it, and that's not coming anytime soon. Incidentally, another advantage of PHP's share-nothing approach that hasn't been mentioned is relatively easy scalability. In a shared pool architecture, the easiest way to scale is typically vertically, that is, adding RAM, faster drives, etc. This is fine, but you can only scale vertically to a certain point, which you can usually hit pretty quickly. With PHP's share-nothing approach, you can still scale vertically, but you can almost as easily scale horizontally by adding more servers that each run merrily in their own worlds, with the primary added coordination logic being in the areas of communicating with the database and the data cache, something the application should be designed with, anyway. In contrast, the shared approach requires added logic, somewhere, to coordinate the sharing amongst the pools of all that data that the application takes for granted is always available at low cost.
Re: [PHP] about lock some codes.
On 27-09-2012 11:31, lx wrote: Hello: I have a question now.the code is: $ftemp = fopen($fdoc_tmp/temp_proxy, 'w'); fwrite($ftemp, $content); fclose($ftemp); exec(/usr/local/bin/gdnsproxy -a -f $fdoc_tmp/temp_proxy 1$fdoc_tmp/dout 2$fdoc_tmp/derr, $data, $ex_result); echo ret=.$ex_result; As you see, If a process run these,this is right.But two processes run this codes. the order maybe is: 1.process 1 create the temp_proxy1 2.process 2 create the temp_proxy2 3.process 1 exec temp_proxy2 4.process 2 exec temp_proxy2 The temp_proxy1 can't exec. So,I want to know how to solve it. Thank you. Well, there are basically 2 ways: 1. introduce locking; you can lock the file and have the other script check if the file is locked. If so have it usleep() and check again. 2. If you can run gdnsproxy in parallel, you could instead change the script to make $fdoc_tmp/temp_proxy unique for that script. So instead of just writing, you first check if the file exists, if so, create a file with a different (non-existent) name and then try again. Otherwise, use the first name. Then pass the 'unique' name to gdnsproxy. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP as Application Server
Il Thu, 27 Sep 2012 12:28:00 +0200, Maciej Liżewski ha scritto: Sure there are disadvantages and other problems but what Alessando is saying is I would not use cure for cancer even if it existed because it can introduce other problems like overpopulation. Uhm, no. I see it as I would not use chemio if I could remove the cancer with laser therapy. They are two ways to solve the same problem, and I think the non- application-server way is the best. It is similar to the Unix way: many small pieces tied together to reach a goal. The application server is more like the Windows way: one big piece to reach a goal. I understand sometimes the application server can be easier or fit better, but I think most of the times it is the wrong solution, expecially in PHP, but not exclusively. Bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP as Application Server
Hi, Once again I didn't read it completely (maybe I will do so), but my 2ct: I recently played with Ruby and Python and of course with their application server (at least a little bit). My experience was, that it is less fun as it sounds in the first place compared to a well designed webserver-interpreter-stack (and of course common OS-specific stuff for CLI). In my eyes it is good the way it is: Let PHP do it's job and let more intelligent tools do the other things, like spawning request-handling processes. Not saying, that I'm against an application, but I currently don't miss it :) On the other side someone must maintain it and someone must make sure, that it is secure and efficient. This resources should not taken from the core-team. Regards, Sebastian 2012/9/27 Alessandro Pellizzari a...@amiran.it Il Thu, 27 Sep 2012 12:28:00 +0200, Maciej Liżewski ha scritto: Sure there are disadvantages and other problems but what Alessando is saying is I would not use cure for cancer even if it existed because it can introduce other problems like overpopulation. Uhm, no. I see it as I would not use chemio if I could remove the cancer with laser therapy. They are two ways to solve the same problem, and I think the non- application-server way is the best. It is similar to the Unix way: many small pieces tied together to reach a goal. The application server is more like the Windows way: one big piece to reach a goal. I understand sometimes the application server can be easier or fit better, but I think most of the times it is the wrong solution, expecially in PHP, but not exclusively. Bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- github.com/KingCrunch
[PHP] Activating the mysql_clear_password plugin
I need to use the mysql_clear_password plugin. I'm using the CentOS php 5.3.3 and manually recompiled the mysql mysqli extensions with the Oracle MySQL 5.5 libraries. According to the MySQL documentation ( http://dev.mysql.com/doc/refman/5.5/en/cleartext-authentication-plugin.html), I need to either set the LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN or set the MYSQL_ENABLE_CLEARTEXT_PLUGIN option to the mysql client. I tried to set the LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN via a SetEnv in Apache with no results. Could anyone help me setting the MYSQL_ENABLE_CLEARTEXT_PLUGIN option to the mysql client ? Regards, Pierre-Gildas MILLON pg.mil...@gmail.com
Re: [PHP] about lock some codes.
On 9/27/2012 7:05 AM, Maciek Sokolewicz wrote: On 27-09-2012 11:31, lx wrote: Hello: I have a question now.the code is: $ftemp = fopen($fdoc_tmp/temp_proxy, 'w'); fwrite($ftemp, $content); fclose($ftemp); exec(/usr/local/bin/gdnsproxy -a -f $fdoc_tmp/temp_proxy 1$fdoc_tmp/dout 2$fdoc_tmp/derr, $data, $ex_result); echo ret=.$ex_result; As you see, If a process run these,this is right.But two processes run this codes. the order maybe is: 1.process 1 create the temp_proxy1 2.process 2 create the temp_proxy2 3.process 1 exec temp_proxy2 4.process 2 exec temp_proxy2 The temp_proxy1 can't exec. So,I want to know how to solve it. Thank you. Well, there are basically 2 ways: 1. introduce locking; you can lock the file and have the other script check if the file is locked. If so have it usleep() and check again. 2. If you can run gdnsproxy in parallel, you could instead change the script to make $fdoc_tmp/temp_proxy unique for that script. So instead of just writing, you first check if the file exists, if so, create a file with a different (non-existent) name and then try again. Otherwise, use the first name. Then pass the 'unique' name to gdnsproxy. Even simpler - use the 'tempnam' or 'tmpfile' functions to always have a unique name and avoid having to check for an existing file. Amazing what the php Manual has in it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] about lock some codes.
On 27-09-2012 15:13, Jim Giner wrote: Even simpler - use the 'tempnam' or 'tmpfile' functions to always have a unique name and avoid having to check for an existing file. Amazing what the php Manual has in it... Good find, I completely forgot about the existence of those functions ;) It's been a long time since I've had to meddle with unique filenames -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Responding to an XML data post
Hi All, I am stuck in something where a 3rd party app pushes an XML post to my site. They need me to respond to that push with a synchronous XML post back confirming that the data was received / had issues etc. Those XMLs are defined, but I am not sure how to push that XML back. A simple echo $xml; is not making back to their system. Not sure how I can post back to their site -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Responding to an XML data post
On Thu, Sep 27, 2012 at 1:48 PM, Bastien Koert phps...@gmail.com wrote: Hi All, I am stuck in something where a 3rd party app pushes an XML post to my site. They need me to respond to that push with a synchronous XML post back confirming that the data was received / had issues etc. Those XMLs are defined, but I am not sure how to push that XML back. A simple echo $xml; is not making back to their system. Not sure how I can post back to their site If it's an actual postback, they should've given you an API endpoint for you to do a cURL post back to their side. If not, and they're just expecting an XML response, it could be that your XML is improperly formatted. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with PHP in Moodle LMS
Has anyone ever heard of a problem with the Moodle LMS when trying to edit an activity (quiz, resource) in which there is a timeout after only a few seconds and a message saying something to the effect of that the system is sorry but there was a time out, please retry. When I look in the URL I see the following after my domain name: .../course/modeit.php Is this purely a Moodle thing, or something someone can help me with. (I've already searched the Moodle site for information about this error, but can't see anything related to version 2.2.3, which I am using.) Any help would be appreciated. I thought I might want to up the timout figure in the php5.ini file in the root directory of my shared Linux hosting with Godaddy, but I don't think that's really the problem. Regards, Gary
RE: [PHP] Problem with PHP in Moodle LMS
Has anyone ever heard of a problem with the Moodle LMS when trying to edit an activity (quiz, resource) in which there is a timeout after only a few seconds and a message saying something to the effect of that the system is sorry but there was a time out, please retry. When I look in the URL I see the following after my domain name: .../course/modeit.php Is this purely a Moodle thing, or something someone can help me with. (I've already searched the Moodle site for information about this error, but can't see anything related to version 2.2.3, which I am using.) Any help would be appreciated. I thought I might want to up the timout figure in the php5.ini file in the root directory of my shared Linux hosting with Godaddy, but I don't think that's really the problem. Regards, Gary Gary, Yes Moodle has a configuration issue. I would switch it to Debug mode and check the error logs it will tell you exactly what is going wrong. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Responding to an XML data post
On Thu, Sep 27, 2012 at 1:00 PM, Daniel Brown danbr...@php.net wrote: On Thu, Sep 27, 2012 at 1:48 PM, Bastien Koert phps...@gmail.com wrote: Hi All, I am stuck in something where a 3rd party app pushes an XML post to my site. They need me to respond to that push with a synchronous XML post back confirming that the data was received / had issues etc. Those XMLs are defined, but I am not sure how to push that XML back. A simple echo $xml; is not making back to their system. Not sure how I can post back to their site If it's an actual postback, they should've given you an API endpoint for you to do a cURL post back to their side. If not, and they're just expecting an XML response, it could be that your XML is improperly formatted. -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Also, make sure you've set the right content type header. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Static constructor support
On Wed, Sep 26, 2012 at 2:29 PM, Yves Goergen nospam.l...@unclassified.dewrote: How do other languages than C# call that? :-) Java has static initializers which work the same way: they are executed when the class is first loaded and before any code can make use of the class. David
Re: [PHP] Round help needed
On Thu, Sep 27, 2012 at 11:05 PM, Chris Payne oxygene...@gmail.com wrote: Hi everyone, I'm having one of those nights where nothing is working, please help What I have is this: $rounded_number = round($test, -3); Here's the problem i'm having, I need it to increment to the nearest 1000 but it seems to only work if the number is over 500. For example: 123666 WILL round to 124000 BUT if I put 123085 (As an example) it doesn't round it, it just stays at 123085 - I know it's probably something totally ridiculously simple but i'm having a mental block tonight. Any help would really be appreciated. Sounds like one of those should be obvious, but isn't issues. This gives the desired result: ?php echo round(123085,-3); ? So I wonder if it's your variable (perhaps even type-casting) or some other portion of your code. Can you elaborate and share some of your bytes with the class, Mr. Payne? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php