libvips / php-vips-ext

Low-level libvips binding for PHP
MIT License
101 stars 11 forks source link

Install problem #21

Closed alexpts closed 6 years ago

alexpts commented 6 years ago

Error: PHP Warning: PHP Startup: Unable to load dynamic library 'vips.so' (tried: /usr/local/Cellar/php/7.2.2_14/lib/php/20170718/vips.so (dlopen(/usr/local/Cellar/php/7.2.2_14/lib/php/20170718/vips.so, 9): image not found), /usr/local/Cellar/php/7.2.2_14/lib/php/20170718/vips.so.so (dlopen(/usr/local/Cellar/php/7.2.2_14/lib/php/20170718/vips.so.so, 9): image not found)) in Unknown on line 0

MacOs, php 7.2, install from pecl

jcupitt commented 6 years ago

Hello @alexpts, it seems to work for me. Here's what I did:

$ brew update
$ brew upgrade
$ brew install vips
$ brew install php

I had to make/usr/local/sbin and chown to john, annoyingly, because /usr/local/ is no longer writeable under 10.13. Then I installed the extension with pecl:

$ pecl channel-update pecl.php.net
$ pecl install vips
downloading vips-1.0.8.tgz ...
Starting to download vips-1.0.8.tgz (557,299 bytes)
.................................................................................................................done: 557,299 bytes
4 source files, building
running: phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
enable vips [yes] : yes
.... etc.
Build process completed successfully
Installing '/usr/local/Cellar/php/7.2.3/pecl/20170718/vips.so'
install ok: channel://pecl.php.net/vips-1.0.8
Extension vips enabled in php.ini

Then I ran this test program:

#!/usr/bin/env php
<?php

require __DIR__ . '/vendor/autoload.php';

use Jcupitt\Vips;

for($i = 0; $i < 2000; $i++) { 
        echo "Loop $i ...\r";

        $im = Vips\Image::newFromFile($argv[1], ["access" => "sequential"]);

        $im = $im->crop(100, 100, $im->width - 200, $im->height - 200);

        $im->writeToFile($argv[2]);
}

echo "\n";

Like this:

$ ./vips.php ~/pics/k2.jpg x.jpg
Loop 1999 ...
$

And it finished successfully.

alexpts commented 6 years ago

I removed extension from php.ini extension="vips.so" and add extension="/usr/local/Cellar/php/7.2.2_14/pecl/20170718/vips.so".

Default resolve path =/usr/local/Cellar/php/7.2.2_14/lib/php/20170718/vips.so. Real ext path=/usr/local/Cellar/php/7.2.2_14/pecl/20170718/vips.so

I think it is problem with brew or pecl.