Jump to content

Using php exec() command. Not working for "custom" script.


truijens

Recommended Posts

Hi,

 

I am trying to run a script using the php exec command. It is called 'Drush'. You might be familiar with it. It's a way to perform certain tasks on a Drupal site using the command line (bypassing Apache).

 

Anyway, when executing my drush command in the terminal manually it works just fine. But when executing it using exec() it doesn't seem to be able to find Drush. I set all the permission of the directory and all its contents to 777 and it is still not working. I am also calling drush using the entire path and not just drush as specified in .bash-profile.

 

Example:

/Applications/drush/drush --root="/Applications/MAMP/htdocs" --uri="client2.drupal.local" usu "nodes"

Where usu is a custom command and nodes is an argument. Again.., this works just fine when run manually in the terminal. Just not when executed using exec().

 

I tried executing 'ls' and that does work...

 

Does anybody have any idea what could be the problem here?

 

Thanks!

 

Roderick

Edited by truijens
Link to comment
Share on other sites

Ok, I found a solution. I was using MAMP on OS X and apparently there is some bug when executing binary executables.

dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib 
Check your apache error log to see if you are encountering the same problem. An explanation and the solution that worked for me is provided here:

 

http://jonathonhill.net/2012-06-22/cannot-run-a-binary-executable-from-php-and-mamp/

 

Good luck!

Edited by truijens
Link to comment
Share on other sites

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.