Open a PDF from a PHP application.

Auteur Réponses
NeilE Dimanche 22 Avril 2012 à 15:04


I am running Ubuntu 10.04.
I need to test PHP applications using Internet Explorer.

I have successfully installed PlayOnlinux and then applications Internet Explorer 6, 7 and 8.

I am trying to run a PHP application.

I have encountered varius issues, but Internet Explorer 6 is doing most of what I want.

When the PHP application creates a PDF and downloads it, Internet
Explorer opens a Window with the prompt : "Would you like to open the
file or save it to your computer?" and displays 4 buttons 'Open' 'Save'
'Cancel' 'More Info'.

If I click 'Save', I can save the PDF and then open it with the Ubuntu PDF viewer.

If, instead, I click 'Open', another pop-up window opens with this message :

"There is no windows program configured to open this type of file."

Is there any way I can associate a PDF file with an application so that theb PDF created by my PHP application will open it?

I did use PlayOnlinux to install Foxit Reader on my "\\Internet Explorer
6\\drive_c" and I set Foxit as the default program to read PDF files.  When I
then open Internet Explorer 6 and click on File | Open and select a
PDF from my hard drive, the file opens successfully in Foxit Reader.

However, I then run my PHP application to create a PDF, and it
behaves exactly as before as described above "Would you like to
open the file or save it to your computer?".  The file association is not recognised.  Can it be done?

Any suggestions appreciated.

Thank you.


ps : I already have Virtual Box running Windows 7 and I can successfully use
this to test my applications.  I thought it might be more convenient
(and more fun!), and less resource hungry, to use Wine, rather than starting Windows.
petch Dimanche 22 Avril 2012 à 15:38

Open the Configure window, select the correct virtual disk, "Miscellaneous" tab, "Open a terminal" button, then type

POL_Call POL_Function_SetNativeExtension "pdf"

Edité par petch

NeilE Lundi 23 Avril 2012 à 2:23

Hi Scripteur,
Thanks for your response. However, It made no difference.
I opened the Configure window, selected the correct virtual disk, "Miscellaneous" tab, "Open a shell" button, then copy and pasted the command you suggested.
I was prompted with : rm: remove regular file $home/.PlayOnLinux//tmp/nativeext.reg?
I noticed that the command you gave me creates this file.
Responding 'y' or 'n' to the prompt made no difference (I presume the file is used to update the registry, so whether or not I delete it after it has been used makes no difference.)
The regisry was updated.
I am still unsuccessful trying to open a PDF created by the PHP application.
petch Lundi 23 Avril 2012 à 7:19

Yes, it associates the extension with "winebrowser", which is the standard way to "exit" the Wine environment and call associated application at the system level:

It guess it didn't work for the same reason installing Foxit didn't work: IE must be doing something strange...
NeilE Lundi 23 Avril 2012 à 7:55

Thanks for your prompt responses Petch.
If I find a solution I will post it back here.