<?php
$cmd = "pwd";
exec($cmd,$o);
print_r($o);
?>
would probably tell you what the working directory of your script is
when run under the web server. (There's probably a better way to do it,
but I didn't see any values specifically about it in the variables
$_SERVER or $_ENV in some old tests I ran).
Anthony
On 7/6/20, 4:43 PM, Anthony Kozar wrote:
> On 7/6/20, 11:57 AM, Bernard Bel wrote:
>
>> After activating gcc I was able to compile an run a tiny program that
>> says "Hello". Then I compiled BP using the Makefile, and it did compile,
>> yielding "bp" or 875 Kb announced as "Unix executable file". It did not
>> work when called from PHP:
>>
>> <?php
>> $cmd = "./bp -v";
>> exec($cmd,$o);
>> print_r($o);
>> ?>
>>
>> "bp32" also did not run. However both run fine when called via Terminal.
>> This means that I have come as far as compiling a correct version of BP
>> under PHP on a MAMP server. Going beyond this step probably requires
>> working on MAMP setup - still a bit obscure to me. I'll manage it; :-)
>
> Hmmm... strange that can't run a macOS binary on macOS just because it
> is called from PHP. I see that your script uses "./bp". Are the PHP
> script and bp in the same directory? You might try using a full
> pathname to bp. Alternatively, try copying the bp binary to somewhere
> on your path (or the web server's CGI bin folder?) and removing the
> "./". Also, "-v" is not a valid option for BP console. I think you
> want "--version".
|