timatgetdim
timatgetdim

Reputation: 183

php code turned gibberish?

I went to edit this PHP file - it's supposed to generate those captcha security images on contact forms - the images werent working, so I was going to see if there was a broken path or something i could fix simply.

But when I opened the file it looked like this: http://mydomainsample.com/explosion/screenshots/Screen%20Shot%202012-05-17%20at%209.34.14%20AM.png

complete gibberish.

Is it possible this happened somehow while downloading the file from the server? I did not have ftp access to the site originally - we got control of the domain and transferred it from one host to another.

I used site sucker to backup the site before transferring, but it downloads php files as html files. you end up with filename.php.html.

in the past this has never turned the php into incomprehensible gibberish, so i dont understand why it did now.

Upvotes: 2

Views: 1342

Answers (3)

gen_Eric
gen_Eric

Reputation: 227270

The problem is, you cannot use programs like "site sucker" to get PHP files. This is because when you get a PHP file from a URL, the file is executed, and you're getting the output of the script. That's why you get .php.html.

It doesn't "turn the php into incomprehensible gibberish", the server runs the script and you're getting the output. Most of the time the output is HTML, which you can open as text. In this case, the script's output is a PNG file, thus why you see "gibberish". Rename the file to .png, then you'll see the image.

You need to get FTP access in order to get the PHP source.

Upvotes: 2

Michal Čihař
Michal Čihař

Reputation: 10091

The file actually looks like a PNG image, maybe you just downloaded output the PHP script has generated?

Upvotes: 1

SLaks
SLaks

Reputation: 887459

That's a PNG image, not PHP source code.

Upvotes: 2

Related Questions