Install imagick php module in dreamhost - php

I'm tryng to install imagick in my VPS at Dreamhost and when I type "phpize" in the imagick-3.0.1 folder I get this:
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
I'm following this tutorial: http://wiki.dreamhost.com/ImageMagick_and_imagick_php_module_on_shared_hosting#Configure_PHP_to_use_this_extension
Any help would be apreciated.

The problem was that the configure script was looking for the
MagickWand.h file in this directory:
/home/bylifeweb/local/include/ImageMagick/wand/MagickWand.h
but the file is actually in this directory
/home/bylifeweb/local/include/ImageMagick-6/wand/MagickWand.h
To fix that I simply made a symlink from ImageMagick to ImageMagick-6 and
ran the configure script again, it worked fine that time and I was then
able to run make.
Libraries have been installed in:
/home/bylifeweb/build/imagick-3.0.1/modules

Related

configure: error: working directory cannot be determined

This is 10000x more easy on Ubuntu or Debian, but my partner who is supposed to be accustomed with CentOS absolutely wanted to use CentOS, but he didn't even know how to install PHP. So I have to do all myself.
We want to install an apache2 server with PHP, PHP-SSH2, PHP-MYSQL, PHP-GD and PHP-CURL.
So I've been trying to install PHP SSH2 on the dedicated server, but I get this error:
downloading ssh2-0.13.tgz ...
Starting to download ssh2-0.13.tgz (28,984 bytes)
.........done: 28,984 bytes
6 source files, building
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
libssh2 prefix? [autodetect] :
building in /var/tmp/pear-build-rootgdfvCp/ssh2-0.13
running: /var/tmp/ssh2/configure --with-ssh2
configure: error: working directory cannot be determined
ERROR: `/var/tmp/ssh2/configure --with-ssh2' failed
How can I fix this?

Compile a third-party DLL to use in PHP

I am trying to compile a third party library into a dll to use in PHP5.6.31. By following the php build directions here, and the dll's reference guide (select 'Using lpsolve from PHP' from the index and scroll down to the compile section). This is what i did.
Downloaded the PHP source php-5.6.31-src.zip from here.
Downloaded the binary tools php-sdk-binary-tools-20110915.zip from here.
Downloaded the php libraries deps-5.6-vc11-x86.7z from here.
Set up the build directory and extracted both the source files and the deps to this directory C:\php-sdk\phpdev\vc11\x86\.
Downloaded lp_solve_5.5.2.5_dev_win32.ziphere and extracted them to C:\lp_solve_5.5.
Downloaded lp_solve_5.5.2.5_PHP_source.tar.gz here and extracted it, then from the extracted files copied this folder lp_solve_5.5\extra\PHP to C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\ext\lp_solve_5.5.
Opened VS2012 x86 Native Tools Command Prompt that came with Visual Studio 2012.
Ran C:\php-sdk>bin\phpsdk_setvars.bat then C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src>buildconf.
Ran C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src>cscript /nologo configure.js --without-xml --without-wddx --without-simplexml --without-dom --without-libxml --disable-zlib --without-sqlite3 --disable-odbc --disable-cgi --enable-cli --without-iconv --enable-phplpsolve55=shared --with-phplpsolve55path="C:\lp_solve_5.5".
Ran nmake php_phplpsolve55.dll which created a dll named php_phplpsolve55 in this directory C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\Release_TS.
I then copied php_phplpsolve55 to my wampserver php extensions folder C:\wamp\bin\php\php5.6.31\ext.
Added this line to my php.ini file extension=php_phplpsolve55.dll.
Then I restarted Wampserver, but the php_lpsolve55 extension does not show up in the loaded extensions. I checked the php_error log and this is the error.
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.6.31/ext/php_phplpsolve55.dll' - The specified module could not be found. in Unknown on line 0
Are there any other ways to troubleshoot this other than the php_error log?
From other posts I read maybe this is a compiler compatibility issue?
Here is my WampServer version.
WampServer version 3.1.0 - 32bit
Apache version: 2.4.27
PHP version: 5.6.31
And here are a few properties from phpinfo()
Compiler: MSVC11 (Visual C++ 2012)
PHP Extension Build: API20131226,TS,VC11
Thread Safety: enabled
Note: I changed line 5 of C:\php-sdk\phpdev\vc11\x86\php-5.6.31-src\ext\lp_solve_5.5\PHPmod.c to static zend_function_entry php_phplpsolve55_functions[] = { I got this from this post.

How to Install pspell with MAMP

I use MAMP for local php development and recently needed to use php's pspell functions for a project. I found little help with this specific scenario (short of recompiling php, yuck) so this post explains how I got it done.
I am not positive but you may need xcode and xcode command line tools installed for this to work. This article might be helpful.
Install MacPorts if you don't have it already
Install aspell and the dictionary of your choice (I used "en"):
sudo port install aspell aspell-dict-en
note: for the next commands, you need to know the version of php you're running on MAMP. You can find this in the MAMP preferences under the PHP tab. For me it's 5.5.18
Download the php source for the version of php you are running,
unarchive it, and move into the pspell source directory:
cd ~/Downloads/php-5.5.18/ext/pspell
Now (being sure to use the proper phpize binary for your php version) do:
/Applications/MAMP/bin/php/php5.5.18/bin/phpize
You should see something like:
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
Next:
./configure --with-php-config=/Applications/MAMP/bin/php/php5.5.18/bin/php-config --with-pspell=/opt/local/
And finally, build the module file:
make
You should now have two files inside the ./modules/ directory: aspell.so and aspell.la - copy them into your php's extensions directory:
cp ./modules/* /Applications/MAMP/bin/php/php5.5.18/lib/php/extensions/no-debug-non-zts-20121212
Now add the extension to your configuration file in /Applications/MAMP/bin/php/php5.5.18/conf/php.ini
extension=pspell.so
Finally, restart your MAMP servers and (hopefully) you are good to go!

How to build mongo.so or PHP with the correct module api version

Trying to install mongoDB on my MAMP setup. I have MAMP 3.05, which comes with PHP 5.5.10. Installed mongo using the instructions from the mongo website and it seems to be running properly. Grabbed mongo extension from the mongo github page and followed their instructions for building and adding the extension to php.ini.
Everything seems ok until I restart MAMP. In php_error.log, I see this:
PHP Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
It looks like the API number for php is a later version, so it would be nice not to have to rebuild an older version of PHP. Is there a way to rebuild the mongo extension with the correct module version, or do I have to discard MAMP and build PHP manually?
Please check with the command which phpize if you use the correct version of the phpize command. This should point to a directory similar to the one you installed your PHP5 into. Mine is found in /usr/bin/phpize which is the default OS X installation.
You can further run phpize -v to check the API version it links against. In my case (the default OS X PHP installation) it outputs:
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
If the outputted API version does not match your required number 20121212 (in my case it is 20100412 which does not match) you are using the wrong phpize to configure the extension.
You have to do this first
sudo cp -r /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S‌​DKs/MacOSX10.10.sdk/usr/include/php /usr/include/php

MAMP PHPize Command

I am trying to run mamp's phpize command on a source code as below:
/Applications/MAMP/bin/php/php5.3.14/bin/phpize
But this is giving me error as below output:
grep: /Applications/MAMP/bin/php/php5.3.14/include/php/main/php.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.3.14/include/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/MAMP/bin/php/php5.3.14/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
Do you have any idea, what is wrong here?
Here's a great guide on how to download and configure the resources that you need:
https://stackoverflow.com/a/11175197/369326

Categories