Forum How do I...?

prince.php on macos 10.4 tiger

michel
prince.php on macos 10.4 tiger:
For neophyte, prince for test is easy to test through command line BUT doc is not king for php : where to install the prince.php containing class prince... where to put the engine folder ?
Do you think apache/php has right to read /usr/local/bin directory ?

Thanks for your help

MS
mikeday
Sorry, it seems that the Prince PHP documentation is a little bit Windows specific at the moment. The engine\bin directory only applies to Windows; on Linux and MacOS X you only need to specify /usr/local/bin/prince, or wherever you have installed Prince.

Usually Apache/PHP will have access to /usr/local/bin, unless it is running in a chroot jail. Anyway, it is easy to find out: try running /usr/local/bin/prince from your PHP script, and check that it works.
michel
After lot of tests :

Basically Tiger is PHP4 - and I discover that the prince class is in PHP5...
(I need to use MAMP to test)

The bin prince is in PPC and not Universal on info window (curiously, it work with command line)

6 hours later :

Some observations :
-not easy to work with Prince in MAMP php5 - bizarrous messages -
- after translation of the php prince kit in php4 - installation in Sites folder of the current account of Tiger (main prince "bin" remain in usr/local) and adapting the 'success' returned message without chr(13)...
- work well with simple html file.
- after creation of a php script to redirect php from a wordpress page to a html file : testing of pdf translation - ok with simple page without image but sometime freezing and big ventilator noise (Macintel MacBookPro) : PRINCE keep 98% of processor but don't finish ... need to kill process...
- to understand what happen, going back to command line... I observe that embedded in php, Prince don't work very well if links (for image or css are relative or incorrect) and don't stop delivering error message as in command line...
- after providing good links in html file (by modifying php of the theme of wp), prince called from php, work as fast as with command-line.... around 5 sec. for a 5 pages.

At this stage, after solving the un easy installation, I am encouraged to continue but some questions need answers to put the prince kit in "production" :
Will the management of errors through php will be improved soon ?
Is Prince "app" will be built in "Universal" ?

Michel - April 21
mikeday
To answer your last questions first, we would like to build a universal binary for Prince on MacOS X, yes. It requires some updates to our build tools though, which is why we haven't done it yet.

Clearly the PHP script needs some work, and the PHP5 vs. PHP4 incompatibility is not very convenient. I'm not quite sure what is happening when you say that Prince doesn't stop delivering error messages; could you try adding the --log=logfile option to Prince to see where it is getting stuck? How does the behaviour differ compared to running it from the command-line?
mikeday
Today we have released an updated PHP interface for Prince. The new class includes more documentation and more methods, and also makes it possible to retrieve error/warning messages. However, it still requires PHP 5; we hope to release an alternative version for PHP 4 in the future.
michel
The prompt upgrade and a good "read me" documentation qualifies a well future.... I will just now test...
michel
After a quick adaptation in PHP4, the Prince interfaced by php script work with better error infos if necessary.
Now, we wait for an Universal release to test if without Rosetta, Prince can become a "king" for Tiger in speed...

Michel