views:

103

answers:

2

Hello,

I have a web application which is developed in cakePHP, but from last few week, a virus is affected to the site and its not showing any pages. even if we go to the source code, nothing is there to display.

I have checked the index.php, there is no extra entry. Can some help me to find out the solution. and, how can i prevent these virus attacks?

Thanks in advance

A: 

Check both the server's error logs and the PHP error log. No output in the browser generally indicates there's a problem with the script and "display_errors" is off, so you get nothing sent.

Marc B
+1  A: 

If you know for sure that you have a virus, then I cannot help you.

If there is a chance that its not a virus...

If you are running PHP, a 'white blank page' can be a symptom of a syntax error.

Somewhere in your code there may be a typo.

Ensure you can spot errors

Try:

Temporally add this to the top of your script

<?php

//ensure errors are displayed
ini_set('display_errors', 1);

//show all type of errors apart from Notices
error_reporting(E_ALL ^E_NOTICE);

Also try removing the closing php tags from the bottom of pure-php scripts:

i.e change:

<?php

//i am 100% php

?>

to

<?php

//i am 100% php

Obviously, keep a closing php tag if it separates php from html.

This is a common coding-practice.

See, for example: - http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html#coding-standard.php-file-formatting.general

Start debugging

A bit of brute force might help. Start at the top of the script and add something like:

<?php

//ensure errors are displayed
ini_set('display_errors', 1);

//show all type of errors apart from Notices
error_reporting(E_ALL ^E_NOTICE);

echo('hello - i got this far');
exit;

//...other code

Refresh the page. If you can see

hello - i got this far

Then you know that it is a problem that you can solve.

Tidy-up / comment-out those lines of code, mentioned above.

Then look into:

Debugging And The Scientific Method

JW