Debug PHP , Write Every Action (and not just errors debug related) into a file

Debug PHP , Write Every Action (and not just errors debug related) into a file

am 15.05.2009 16:55:35 von onemancrew

Hello

I am using PHP Version 4 Over Windows Server 2003 , the webserver
application is IIS 6

I couldn't find a way to debug PHP and enable the debug.
I would like that every action that PHP is doing will be written into a
file.
I think that PHP doesn't support such feature but I am here to confirm it.
I am not talking about writting only errors , I would like to debug any
action that the php is doing.

thanks

onemancrew


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

Re: Debug PHP , Write Every Action (and not just errors

am 15.05.2009 17:08:35 von Ferenc Kovacs

--001485f5ce6a89545f0469f4d181
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

2009/5/15 onemancrew

> Hello
>
> I am using PHP Version 4 Over Windows Server 2003 , the webserver
> application is IIS 6
>
> I couldn't find a way to debug PHP and enable the debug.
> I would like that every action that PHP is doing will be written into a
> file.
> I think that PHP doesn't support such feature but I am here to confirm it.
> I am not talking about writting only errors , I would like to debug any
> action that the php is doing.
>
> thanks
>
> onemancrew
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> xdebug
Tyrael

--001485f5ce6a89545f0469f4d181--

Re: Debug PHP , Write Every Action (and not just errors debug related) into a file

am 15.05.2009 18:21:12 von onemancrew

We are talking about shared hosting server.

I don't care about stack , memory allocation and etc.

I would like to find the exploit web site that through this web site
spammers are sending spam (relay)

any suggestion ?

thanks

onemancrew

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

Re: Debug PHP , Write Every Action (and not just errors debug related) into a file

am 16.05.2009 12:20:03 von onemancrew

Hi Again

I am the server administrator.

some details about the server:

OS: Windows Server 2003
PHP Version: PHP 4.4.6 (cgi-fcgi) (built: Feb 28 2007 21:35:46)
MailServer Application: MailEnable (works under Windows OS)

How do I know that the source of the problem is PHP ?
Because I have investigated the email header and I have found that the
emails have been created through PHP.
It's 200% that the spam emails have been created through PHP code.

The Mail() function is enable. Also I provide mail relay only to requests
which comes from localhost (127.0.0.1)
What does it means ?
it means that if a php script try to create new email envelop and in the
script the mail server which is defined is 127.0.0.1 or localhost then the
php script will be able to create the email envelop. Also in such case no
authentication is required.

The relay option for 127.0.0.1 or localhost is defined in the Email Server
Application (MailEnable).
And I must use such setting because I have php applications which don't make
any authentication through the email server.

Under this server I have alots of web sites.
So I can't start checking each IIS log file on daily basis.

I have enabled the error php debug file. but it is only log unsuccessful php
actions.
So this log file doesn't provide me information regarding success mail()
function operation.
And because of that I can't track after the source of the PHP code which
create those emails envelop.

What I need is the following (because I don't find any better solution):
I must have the capability to track any php action into a file.
I need to have the capability to track down each action that php.exe is
doing in relevant of mail() function.

I did some investigation and couldn't find internal feature inside php.exe
to log any action that it's doing (not only errors).

Regarding the additional_parameters and the vhost-unique key.
I think that I can't implement such feature while PHP is working under
Windows OS and While the Email Server Application is MailEnable.
I think that such feature is eligible and working only when the Email Server
Application is SendMail.
Because MailEnable doesn't support special Key processing.

Any Suggestion ?


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

RE: Debug PHP , Write Every Action (and not just errors debug related) into a file

am 18.05.2009 04:02:36 von Louis Solomon

eW91IGNvdWxkIHVzZSBlcnJvcl9sb2coKSB3aXRoIF9fTElORV9fIF9fRklM RV9fIHJpZ2h0IGJl
Zm9yZSBlYWNoIGNhbGwgdG8gbWFpbCgpIHRvIHRyYWNrIHRoZSB1c2FnZS4g IFllcyB0aGlzIGRv
ZXMgbWVhbiBzZWFyY2hpbmcgYW5kIGVkaXRpbmcgYSBsb3Qgb2YgZmlsZXMs IGJ1dCBpdCB3aWxs
IGdldCB5b3UgYW4gYW5zd2VyIChvciBtb3JlIGFjY3VyYXRlbHkgaXQgd2ls bCBzaG93IHlvdSB3
aGF0IGlzIG5vdCBjYXVzaW5nIGl0LiAgQXMgaXQgbWF5IG5vdCBiZSBwaHAn cyBtYW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vZyBhbnkgYWN0aW9uIHRo YXQgaXQncyBkb2lu
ZyAobm90IG9ubHkgZXJyb3JzKS4NCg0KUmVnYXJkaW5nIHRoZSBhZGRpdGlv bmFsX3BhcmFtZXRl
cnMgYW5kIHRoZSB2aG9zdC11bmlxdWUga2V5Lg0KSSB0aGluayB0aGF0IEkg Y2FuJ3QgaW1wbGVt
ZW50IHN1Y2ggZmVhdHVyZSB3aGlsZSBQSFAgaXMgd29ya2luZyB1bmRlciAN CldpbmRvd3MgT1Mg
YW5kIFdoaWxlIHRoZSBFbWFpbCBTZXJ2ZXIgQXBwbGljYXRpb24gaXMgTWFp bEVuYWJsZS4NCkkg
dGhpbmsgdGhhdCBzdWNoIGZlYXR1cmUgaXMgZWxpZ2libGUgYW5kIHdvcmtp bmcgb25seSB3aGVu
IHRoZSBFbWFpbCBTZXJ2ZXIgDQpBcHBsaWNhdGlvbiBpcyBTZW5kTWFpbC4N CkJlY2F1c2UgTWFp
bEVuYWJsZSBkb2Vzbid0IHN1cHBvcnQgc3BlY2lhbCBLZXkgcHJvY2Vzc2lu Zy4NCg0KQW55IFN1
Z2dlc3Rpb24gPyANCg0KDQotLSANClBIUCBXaW5kb3dzIE1haWxpbmcgTGlz dCAoaHR0cDovL3d3
dy5waHAubmV0LykNClRvIHVuc3Vic2NyaWJlLCB2aXNpdDogaHR0cDovL3d3 dy5waHAubmV0L3Vu
c3ViLnBocA0KDQo=

Re: Debug PHP , Write Every Action (and not just errors

am 18.05.2009 14:17:35 von Richard Quadling

2009/5/18 Louis Solomon :
> you could use error_log() with __LINE__ __FILE__ right before each call t=
o mail() to track the usage.  Yes this does mean searching and editing=
a lot of files, but it will get you an answer (or more accurately it will =
show you what is not causing it.  As it may not be php's mail func con=
tracy to what the email headers show, as they could be faked).
>
> Ps if you want to write a wrapper func then use debug_backtrace() to iden=
tify the caller instead of __LINE__ __FILE__
>
> Louis Solomon
> www.SteelBytes.com
>
>
> -----Original Message-----
> From: onemancrew [mailto:ilan@wserv.co.il]
> Sent: Saturday, 16 May 2009 8:20 PM
> To: php-windows@lists.php.net
> Subject: Re: [PHP-WIN] Debug PHP , Write Every Action (and not just error=
s debug related) into a file
>
> Hi Again
>
> I am the server administrator.
>
> some details about the server:
>
> OS: Windows Server 2003
> PHP Version: PHP 4.4.6 (cgi-fcgi) (built: Feb 28 2007 21:35:46)
> MailServer Application: MailEnable (works under Windows OS)
>
> How do I know that the source of the problem is PHP ?
> Because I have investigated the email header and I have found that the
> emails have been created through PHP.
> It's 200% that the spam emails have been created through PHP code.
>
> The Mail() function is enable. Also I provide mail relay only to requests
> which comes from localhost (127.0.0.1)
> What does it means ?
> it means that if a php script try to create new email envelop and in the
> script the mail server which is defined is 127.0.0.1 or localhost then th=
e
> php script will be able to create the email envelop. Also in such case no
> authentication is required.
>
> The relay option for 127.0.0.1 or localhost is defined in the Email Serve=
r
> Application (MailEnable).
> And I must use such setting because I have php applications which don't m=
ake
> any authentication through the email server.
>
> Under this server I have alots of web sites.
> So I can't start checking each IIS log file on daily basis.
>
> I have enabled the error php debug file. but it is only log unsuccessful =
php
> actions.
> So this log file doesn't provide me information regarding success mail()
> function operation.
> And because of that I can't track after the source of the PHP code which
> create those emails envelop.
>
> What I need is the following (because I don't find any better solution):
> I must have the capability to track any php action into a file.
> I need to have the capability to track down each action that php.exe is
> doing in relevant of mail() function.
>
> I did some investigation and couldn't find internal feature inside php.ex=
e
> to log any action that it's doing (not only errors).
>
> Regarding the additional_parameters and the vhost-unique key.
> I think that I can't implement such feature while PHP is working under
> Windows OS and While the Email Server Application is MailEnable.
> I think that such feature is eligible and working only when the Email Ser=
ver
> Application is SendMail.
> Because MailEnable doesn't support special Key processing.
>
> Any Suggestion ?
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

An option (you may or may not want to take) is to upgrade to a later
release of PHP (would have to be 5.3 which is still a dev release) and
then you could use the mail.log option to record any mail being sent
using the mail() function.

This does not log the use of using sockets (or any other technique) to
send email.



--=20
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
"Standing on the shoulders of some very clever giants!"

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