php-general Digest 13 Jun 2011 09:05:40 -0000 Issue 7355
Topics (messages 313493 through 313497):
debugging using error_log stuff
313493 by: Tamara Temple
Re: execute my php code before every php call
313494 by: Tamara Temple
313495 by: Stuart Dallas
Re: [pmwiki-users] debugging using error_log stuff
313496 by: Tamara Temple
313497 by: Richard Quadling
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
I read the recipe on debugging pmwiki functions and such at
< http://www.pmwiki.org/wiki/Cookbook/DebuggingForCookbookAuthors >
This isn't a PmWiki problem, per se, which is why it's going to both
lists.
I inserted the little sms function into pmwiki.php itself to try out
(PmWiki developers: is there a better place to do this?)
It's working, but I modified it slightly to log sms's:
function sms($text,$switch=0){
global $MessagesFmt;
error_log(date(DATE_RFC822)." Entered sms. text=$text. switch=$switch
\n",3,"/var/log/pmwiki/error.log");
if ($switch == true || is_array($text)) {
$MessagesFmt[] = "<pre>" . print_r($text,true) . "</pre>\n";
} else {
$MessagesFmt[] = $text . "<br />\n";
}
error_log(date(DATE_RFC822)." Exit sms.\n");
}
So that i could watch it execute by tailing the error log.
I put the following line at the very top of pmwiki.php:
error_log(date(DATE_RFC822)." pmwiki start\n",3,"/var/log/pmwiki/
error.log");
Then, down below, after where $MessagesFmt is zeroed out, I put:
sms("Test Debugging");
However, all I see in the error log is the startup message, the entry
message, BUT no exit message appears:
Sun, 12 Jun 11 14:10:27 -0500 pmwiki start
Sun, 12 Jun 11 14:10:27 -0500 Entered sms. text=Test Debugging. switch=0
The sms message shows up in the (:messages:) markup as expected.
Any ideas what I'm doing wrong? This is stumping me.
--- End Message ---
--- Begin Message ---
On Jun 12, 2011, at 1:46 PM, techloop wrote:
I have a simple code that override some env vars but i need it to
run before
any other php code on every php execution.
Have you looked at http://us.php.net/manual/en/ini.core.php#ini.auto-prepend-file
?
--- End Message ---
--- Begin Message ---
On 12 Jun 2011, at 19:46, "techloop" <[email protected]> wrote:
> Hi all,
>
> I have a simple code that override some env vars but i need it to run before
> any other php code on every php execution.
> I would like to avoid any change of all php code (even if its only to
> include the include command).
>
> Any one knows of such way ?
>
> I dont mind overriding this vars on php configuration file but i dont have
> any control of it as its should work on even the most strict web hosting
> (that still allow env vars manipulation)
>
> Any alternatives ?
>
> Thanks,
>
> TL
Look up the auto_prepend_file php.ini configuration option. That should give
you the functionality you're after.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
Sent from my leaf blower
--- End Message ---
--- Begin Message ---
On Jun 12, 2011, at 4:32 PM, Peter Bowers wrote:
On Sun, Jun 12, 2011 at 3:18 PM, Tamara Temple <[email protected]
> wrote:
function sms($text,$switch=0){
global $MessagesFmt;
error_log(date(DATE_RFC822)." Entered sms. text=$text.
switch=$switch\n",3,"/var/log/pmwiki/error.log");
if ($switch == true || is_array($text)) {
$MessagesFmt[] = "<pre>" . print_r($text,true) . "</
pre>\n";
} else {
$MessagesFmt[] = $text . "<br />\n";
}
# error_log(date(DATE_RFC822)." Exit sms.\n");
error_log(date(DATE_RFC822)." Exit
sms.\n",3,"/var/log/pmwiki/error.log");
}
Missing arguments #2 and #3 -- try as modified above.
-Peter
D'oh. Sometimes you stare and stare and stare at something and you
still don't see it. Thanks a bunch.
--- End Message ---
--- Begin Message ---
On 12 June 2011 22:57, Tamara Temple <[email protected]> wrote:
>
> On Jun 12, 2011, at 4:32 PM, Peter Bowers wrote:
>
>> On Sun, Jun 12, 2011 at 3:18 PM, Tamara Temple <[email protected]>
>> wrote:
>>>
>>> function sms($text,$switch=0){
>>> global $MessagesFmt;
>>> error_log(date(DATE_RFC822)." Entered sms. text=$text.
>>> switch=$switch\n",3,"/var/log/pmwiki/error.log");
>>> if ($switch == true || is_array($text)) {
>>> $MessagesFmt[] = "<pre>" . print_r($text,true) .
>>> "</pre>\n";
>>> } else {
>>> $MessagesFmt[] = $text . "<br />\n";
>>> }
>>
>> # error_log(date(DATE_RFC822)." Exit sms.\n");
>> error_log(date(DATE_RFC822)." Exit
>> sms.\n",3,"/var/log/pmwiki/error.log");
>>>
>>> }
>>
>> Missing arguments #2 and #3 -- try as modified above.
>>
>> -Peter
>
> D'oh. Sometimes you stare and stare and stare at something and you still
> don't see it. Thanks a bunch.
>
Would the use of ...
error_reporting(-1);
ini_set('display_errors', 1);
have helped during your development?
--
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea
--- End Message ---