How to run a php script which contains a pdf

Bob McConnell rmcconne at lightlink.com
Sun Nov 1 12:13:22 UTC 2009


Nigel Henry wrote:
> On Saturday 31 October 2009 21:29, Athmane Madjoudj wrote:
>> On Sat, Oct 31, 2009 at 9:25 PM, Nigel Henry
>>
>> <cave.dnb2m97pp at aliceadsl.fr> wrote:
>>> I was trying to read an online tool catalogue, and noticed a PDF button
>>> at the bottom of the webpage. Clicked on it, and it opened the dialog box
>>> to download. What has been downloaded though is a .php script (27.3MB).
>>>
>>> The properties shows that it contains a pdf document, but I've no idea
>>> how to run it, open it, or whatever needs to be done, to get to see the
>>> PDF.
>>>
>>> Any suggestions folks.
>>>
>>> Nigel.
>>
>> Try to rename it:
>>
>> mv FILE_NAME.php FILE_NAME.pdf
>>
>> and open it with Evince
>>
> 
> Renaming it has done the job, and it has opened with no problems.
> 
> Many thanks.
> 
> Nigel.

There is a simple way to check a file to see if it really is a pdf. Open 
it in a text editor. If the first four characters are '%pdf', then it is 
safe to rename it.

These first four bytes are the magic number in Unix based systems. This 
is a much more reliable and flexible way to mark files with a type than 
the extensions used by Microsoft. I believe the 'type' command will also 
tell you what this marker means. i.e. 'type FILE_NAME.php'.

Bob McConnell
N2SPP




More information about the fedora-list mailing list