Forum How do I...?

Prince and MAMP

wout611
Hi all,


I am trying to run Prince 7.1 via PHP on a OSX system with MAMP, but it does not seem to work. The error message I am getting is:

"Fatal error: Class 'Prince' not found in /Users/...."


with the PHP code:

<?php

$prince = new Prince("/usr/local/bin/prince");

include ('prince.php');
$text1 = $_REQUEST['text1'];

//passthru ('/usr/local/bin/prince --version > /tmp/prince.log 2>&1');

header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="foo.pdf"');

convert_string_to_passthru($text1);
?>


I've already looked around the forums and the un-commenting of two lines in envars did not solve the problem. As you can see in the code i've already tried a passthru command and this nicely returns the correct version in prince.log.

Whatever I do, I get the same message that Class prince is not found.


I hope that someone can help me!


Regards,

Wout

Edit: I'm using MAMP 1.9.4 with PHP 5.3.2, PHP 5.2.13 also didn't work..
mikeday
It sounds like it cannot find the prince.php file. Does this need to be installed in a particular location for MAMP to find it?
wout611
I'm sorry I did not copy the whole PHP error line, but it says that the Fatal Error is caused on line 3; the line where the prince class is called.

The include on line 5 seems to be correct, i already checked.

I have no idea why, but it cannot find "Prince" on line 3, although the path to prince (/usr/local/bin/prince) is correct!
mikeday
You need to include prince.php before creating a new Prince class, right? :)
wout611
I think you are very very VERY right...

I guess tunnelvision made me miss that.

Thank you!