pHash-0.9.6 was released at 2013-04-23, but there are serveral problems for certain usage
Based on yftzeng's work for two patches:
- Compatible with new PHP version (Compile/Install passed).
- Change
ph_dct_imagehash()
function to return hash string for further operation.
And in addition, I added two patches for ffmpeg 2.3+ compatibility, which is also for the ruby binding compatibility
- Add init NULL value for pFormatCtx (Fixed Video hash)
- extern "C" for all functions in audiophash.h (Fixed Audio hash)
$ sudo apt-get install libavformat-dev libmpg123-dev libsamplerate-dev libsndfile-dev
$ sudo apt-get install cimg-dev libavcodec-dev ffmpeg libswscale-dev
$ cd pHash-0.9.6
$ ./configure
$ make && sudo make install
gem install pHash
$ cd bindings/php
$ phpize
$ ./configure LIBS="-lpthread"
$ make && sudo make install
If you have PHP 5:
$ sudo vi /etc/php5/conf.d/pHash.so
extension=pHash.so
$ sudo php5enmod pHash
$ php -m
pHash
If you have PHP 7:
sudo echo "extension=pHash.so" | sudo tee /etc/php/7.0/mods-available/pHash.ini
sudo phpenmod pHash
php -m
# you should see pHash in the list