0

I am running PHP 5.5 on Mac OS X Yosemite. PHP 5.5 is installed with Homebrew.

I have a .php script that has to be executed asynchronously (from CLI). If I execute it from terminal, it works fine. However, if I execute it within my PHP application it does not work.

Code that launches the script (run by Apache) is:

// 1.- Alter path so that Homebrew PHP is launched
putenv("PATH=/usr/local/bin:" . getenv("PATH"));

// 2.- Exec PHP script in background
exec("php /path/to/my/file/script.php > /dev/null &");

I get the following error:

Library not loaded: /usr/local/lib/libpng16.16.dylib
  Referenced from: /usr/local/bin/php
  Reason: no suitable image found.  Did find:
    /usr/local/lib/libpng16.16.dylib: stat() failed with errno=13
    /usr/local/lib/libpng16.16.dylib: stat() failed with errno=13

Any clues?

I already tried solution in dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib with anything php related with no luck

Community
  • 1
  • 1
German Latorre
  • 10,058
  • 14
  • 48
  • 59

1 Answers1

2

The stat() failed with errno=13 indicates that there is a permissions error. The .dylib file should have read permissions, and the directories it is contained within should have the executable (x) bit set as well. (I think the read [r] bit should be set, too, but I'm not 100% sure.)

mipadi
  • 398,885
  • 90
  • 523
  • 479