Jump to content

[SOLVED] exec() issue on my Mac


ultrus

Recommended Posts

Hi,

The following works fine:

<?php
$command = 'ls';
exec($command, $output);
print_r($output); //all files and folders are listed in my current php file directory
?>

 

However, when I try to run a 3rd party program of any kind from command line, nothing happens. No errors. No results either. I can echo out the command I'm running, copy, paste into terminal, and it runs fine.

 

I'm thinking it's some kind of user permission issue? Any guess on how to resolve this?

 

I'm using MAMP.

 

Thanks much. :)

Link to comment
https://forums.phpfreaks.com/topic/164539-solved-exec-issue-on-my-mac/
Share on other sites

Hello rhodesa,

Thanks for the quick feedback. Your tip returned an error message array.

 

command:

swift "test" 2>&1

 

output:

Array

(

    [0] => dyld: Symbol not found: __cg_jpeg_resync_to_restart

    [1] =>  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO

    [2] =>  Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib

    [3] =>

)

 

What's supposed to happen is the computer will say "hello" using Cepstral's text-to-speech engine and command line program they call Swift.

 

Not sure what this has to do with jpegs. Any thoughts?: I'll start digging around.

Sure thing. Here it is in full:

 

<?php
class Swift {
public $defaultVoice; //not used yet

public function __construct() {
	//stuff soon
}

public function sayHello() {
	$output = "";

	$command = 'swift "test" 2>&1';

	exec($command, $output);
	print_r($output);

	return true;
}
}

//example usage:
$swift = new Swift();
$swift->sayHello();
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.