Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php 7.1.19 Bug? #1406

Closed
2 tasks
ServiceYun opened this issue Sep 17, 2018 · 15 comments
Closed
2 tasks

php 7.1.19 Bug? #1406

ServiceYun opened this issue Sep 17, 2018 · 15 comments

Comments

@ServiceYun
Copy link

ServiceYun commented Sep 17, 2018

Expected behaviour

Actual behaviour

PHP Startup: Unable to load dynamic library '/usr/local/php/modules/redis.so' - dlopen(/usr/local/php/modules/redis.so, 9): no suitable image found. Did find: /usr/local/php/modules/redis.so: code signature in (/usr/local/php/modules/redis.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. /usr/local/php/modules/redis.so: stat() failed with errno=1

I'm seeing this behaviour on

  • OS: Mac(mojave)
  • Redis: None
  • PHP: 7.1.19
  • phpredis: 4.1.1

Steps to reproduce, backtrace or example script

I've checked

  • There is no similar issue from other users
  • Issue isn't fixed in develop branch
@yatsukhnenko
Copy link
Member

yatsukhnenko commented Sep 17, 2018

@ServiceYun how did you install phpredis in your system?

@ServiceYun
Copy link
Author

ServiceYun commented Sep 17, 2018

@ServiceYun how did you install phpredis in your system?

phpize
./configure
sudo make
cp modules/redis.so [file]

and in branch master
and in source 4.1.1.tar.gz

come to the same thing

@yatsukhnenko
Copy link
Member

@ServiceYun did you try homebrew or mackports?

@michael-grunder
Copy link
Member

This looks like some sort of OSX security thing:

code signature in (/usr/local/php/modules/redis.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed

I run phpredis on OSX High Sierra and haven't encountered this. I did have to jump through a bunch of hoops to get GDB to function properly, but I'm not sure what the solution would be for a shared object.

@ServiceYun
Copy link
Author

@ServiceYun did you try homebrew or mackports?

No, I replaced it with docker(php-fpm) for the time being.

@ServiceYun
Copy link
Author

This looks like some sort of OSX security thing:

code signature in (/usr/local/php/modules/redis.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed

I run phpredis on OSX High Sierra and haven't encountered this. I did have to jump through a bunch of hoops to get GDB to function properly, but I'm not sure what the solution would be for a shared object.

Will the problem lie on PHP version? No error during compilation.

@Jaessun
Copy link

Jaessun commented Sep 21, 2018

It seems that Apple implemented Library Validation through Apache on MacOS Mojave. That makes it apparently impossible to load unsigned binaries with Apache. I have the exact same issue when I try to load a custom version of PHP 7.2 (that I got from https://php-osx.liip.ch/).

httpd: Syntax error on line 182 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/php5/libphp7.so into server: dlopen(/usr/local/php5/libphp7.so, 10): no suitable image found. Did find:\n\t/usr/local/php5/libphp7.so: code signature in (/usr/local/php5/libphp7.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.\n\t/usr/local/php5/libphp7.so: stat() failed with errno=22

That custom PHP 7.2 was working fine before I upgraded to Mojave but now I can't load it because of that Library Validation. I even tried to sign the php7 binary with a self-signed certificate but then I got this error instead:

httpd: Syntax error on line 182 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/php5/libphp7.so into server: dlopen(/usr/local/php5/libphp7.so, 10): no suitable image found. Did find:\n\t/usr/local/php5/libphp7.so: code signature in (/usr/local/php5/libphp7.so) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)\n\t/usr/local/php5/libphp7.so: stat() failed with errno=22

To summarize, Apache will not load the binary unless it passes Apple's Library Validation. If anyone has any idea on how to make it pass that validation, or maybe disable that on Apache as a workaround that would be really helpful for Mojave users :)

@michael-grunder
Copy link
Member

Since Mojave is not officially released yet I was unable to find much information on this new feature of OSX.

I did come across this blog which does seem related:
http://www.lapcatsoftware.com/articles/debugging-mojave.html

The blog mentions running this command:
/usr/sbin/DevToolsSecurity -enable

I don't know if this tool is related to library validation but it might be worth a try. I suspect a whole lot more information will become available when Mojave is officially released.

@Jaessun
Copy link

Jaessun commented Sep 24, 2018

DevToolsSecurity was already enabled on my system, so unfortunately that didn't change anything.

For now as a workaround I was able to load my module into Apache by disabling the System Integrity Protection on my mac.

@boruns
Copy link

boruns commented Sep 27, 2018

i has running /usr/sbin/DevToolsSecurity -enable,now,
httpd: Syntax error on line 171 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/opt/php/lib/httpd/modules/libphp7.so into server: dlopen(/usr/local/opt/php/lib/httpd/modules/libphp7.so, 10): no suitable image found. Did find:\n\t/usr/local/opt/php/lib/httpd/modules/libphp7.so: code signature in (/usr/local/opt/php/lib/httpd/modules/libphp7.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.\n\t/usr/local/opt/php/lib/httpd/modules/libphp7.so: stat() failed with errno=22

@michael-grunder
Copy link
Member

I'm going to close this issue because it's not really a bug in phpredis but rather an apparent issue with running custom libraries under Mojave.

@danmolina
Copy link

try this guys, it works for me https://superuser.com/questions/1363013/apache-cant-load-php-unsigned-extensions-on-mac-os-mojave

@ServiceYun
Copy link
Author

I'm going to close this issue because it's not really a bug in phpredis but rather an apparent issue with running custom libraries under Mojave.

Thanks.

@ServiceYun
Copy link
Author

try this guys, it works for me https://superuser.com/questions/1363013/apache-cant-load-php-unsigned-extensions-on-mac-os-mojave

Thank you. I'm a bit busy today. I will try it tomorrow and reply to you.

@marvix
Copy link

marvix commented Jan 17, 2019

try this guys, it works for me https://superuser.com/questions/1363013/apache-cant-load-php-unsigned-extensions-on-mac-os-mojave

Thank you. I'm a bit busy today. I will try it tomorrow and reply to you.

did work for me, any solution??!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants