Jump to content

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();
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.