Created
February 28, 2017 00:07
-
-
Save jamesmontalvo3/e0734a02c460c36fbfe71ae7e0fc5071 to your computer and use it in GitHub Desktop.
Install phash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# | |
# Download required libraries | |
cd ~ | |
mkdir download | |
cd download | |
yum install -y libsndfile-devel unzip | |
wget http://cimg.eu/files/CImg_latest.zip | |
wget http://www.phash.org/releases/pHash-0.9.6.tar.gz | |
# JUST FOR AUDIO? Fails without... | |
wget http://www.mega-nerd.com/SRC/libsamplerate-0.1.8.tar.gz | |
wget http://sourceforge.net/projects/mpg123/files/mpg123/1.15.1/mpg123-1.15.1.tar.bz2/download | |
# Compile required libraries for pHash if audio and video required | |
# AUDIO | |
~/download | |
tar xvf libsamplerate-0.1.8.tar.gz | |
cd libsamplerate-0.1.8 | |
./configure | |
make && make install | |
# AUDIO | |
~/download | |
tar xvf mpg123-1.15.1 | |
cd mpg123-1.15.1 | |
./configure | |
make && make install | |
# We need to copy CImg.h in the /user/local/include folder | |
cd ~/download | |
unzip CImg_latest.zip | |
cp CImg*/CImg.h /usr/local/include | |
# Compile pHash library | |
tar xvf pHash-0.9.6.tar.gz | |
cd pHash-0.9.6 | |
./configure --enable-video-hash=no --enable-audio-hash=no --enable-pthread | |
make && make install | |
# Compile the PHP extension | |
# $ cd bindings/php | |
# $ phpize | |
# $ ./configure LIBS="-lpthread" | |
# Edit pHash.cpp | |
# I had to edit pHash.cpp to fix a compilation error. I think you only need to do it if you are using php >=5.3 | |
# line 106, replace "function_entry" by "zend_function_entry" | |
# save and close | |
# $ vi /root/download/pHash-0.9.5/bindings/php/pHash.cpp | |
# Finish the compilation | |
$ make | |
$ make test | |
$ make install | |
# finally enable pHash in the php.ini adding extension=pHash.so | |
# restart apache | |
cd ~/desdrive | |
npm install phash | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment