PHP Imagick problems - php

So i'm trying to download the imagick dependency. I already have the ImageMagick installed through homebrew now i'm trying to put the imagick directory in with: (i'm using mac OS)
sudo pecl install imagick
i get the following error
downloading imagick-3.2.0RC1.tgz ...
Starting to download imagick-3.2.0RC1.tgz (163,503 bytes)
...................................done: 163,503 bytes
16 source files, building
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
ERROR: `phpize' failed
Here is my current setup directory of pear
1. Installation base ($prefix) : /usr/local/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /usr/local/bin
5. PHP code directory ($php_dir) : /usr/local/pear/share/pear
6. Documentation directory : /usr/local/pear/docs
7. Data directory : /usr/local/pear/data
8. User-modifiable configuration files directory : /usr/local/pear/cfg
9. Public Web Files directory : /usr/local/pear/www
10. Tests directory : /usr/local/pear/tests
11. Name of configuration file : /private/etc/pear.conf

Related

Getting a fatal PHP error on MAMP Pro after windows 10 update

MAMP PRO Windows v5.0.5 on Windows 10
PHP 8.1.0 (identical version for all hosts)
Everything was working yesterday. I restarted my machine which came with a Windows update and since I am getting this error:
PHP Fatal error: Failed opening required 'C:/Users/Alex Leuschner/OneDrive/Mampilly/Polygon/market-data/index.php' (include_path='.;C:\php\pear') in Unknown on line 0
The index.php file is a simple PHP that echos a string.
echo 'Hello World';
I installed PEAR in C:\
PS C:\> php go-pear.phar
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : system
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : C:\
2. Temporary directory for processing : C:\tmp
3. Temporary directory for downloads : C:\tmp
4. Binaries directory : C:\
5. PHP code directory ($php_dir) : C:\pear
6. Documentation directory : C:\docs
7. Data directory : C:\data
8. User-modifiable configuration files directory : C:\cfg
9. Public Web Files directory : C:\www
10. System manual pages directory : C:\man
11. Tests directory : C:\tests
12. Name of configuration file : C:\WINDOWS\pear.ini
13. Path to CLI php.exe : C:\MAMP\bin\php\php8.1.0
1-13, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\WINDOWS\pear.ini...
Initialized registry...
Preparing to install...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.4.14.tar...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.4.3.tar...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.10.13.tar...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.1.1.tar...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.4.5.tar...
warning: pear/PEAR dependency package "pear/Archive_Tar" downloaded version 1.4.14 is not the recommended version 1.4.4
install ok: channel://pear.php.net/Archive_Tar-1.4.14
install ok: channel://pear.php.net/Console_Getopt-1.4.3
install ok: channel://pear.php.net/Structures_Graph-1.1.1
install ok: channel://pear.php.net/XML_Util-1.4.5
install ok: channel://pear.php.net/PEAR-1.10.13
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
******************************************************************************
WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<C:\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.
Would you like to alter php.ini <C:\MAMP\bin\php\php8.1.0\php.ini>? [Y/n] : y
php.ini <C:\MAMP\bin\php\php8.1.0\php.ini> include_path updated.
Current include path : C:\MAMP\bin\php\php8.1.0\
Configured directory : C:\pear
Currently used php.ini (guess) : C:\MAMP\bin\php\php8.1.0\php.ini
Press Enter to continue:
** WARNING! Old version found at C:\, please remove it or be sure to use the new c:\\pear.bat command
The 'pear' command is now at your service at c:\\pear.bat
** The 'pear' command is not currently in your PATH, so you need to
** use 'c:\\pear.bat' until you have added
** 'C:\' to your PATH environment variable.
Run it without parameters to see the available actions, try 'pear list'
to see what packages are installed, or 'pear help' for help.
For more information about PEAR, see:
http://pear.php.net/faq.php
http://pear.php.net/manual/
Thanks for using go-pear!
* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\PEAR_ENV.reg .
This file creates ENV variables for the current user.
Double-click this file to add it to the current user registry.
In PHP.ini I updated the include page to: C:\MAMP\bin\php\php8.1.0\
I verified on the command line, php -i and get:
include_path => C:\MAMP\bin\php\php8.1.0\ => C:\MAMP\bin\php\php8.1.0\
When I try again, I get the updated error:
PHP Fatal error: Failed opening required 'C:/Users/Alex Leuschner/OneDrive/Mampilly/Polygon/market-data/index.php' (include_path='C:\MAMP\bin\php\php8.1.0\') in Unknown on line 0
Thanks for your help!
As commented by #kmoser, this question solved the issue: Windows updateWarning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
I moved my files out of OneDrive and no longer experienced the issue when executing a PHP script.

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.

Issue binding ZeroMQ to PHP In MacOS

I am attempting to add the ZeroMQ extension's PHP functionality to my local server. I have successfully installed it however binding it to the PHP of my system has been a challenge.
I've attempted both the PEAR/PECL and Github building methods however they all come down to this CLI Error:
In file included from /private/tmp/pear/install/zmq/zmq.c:31:
/private/tmp/pear/install/zmq/php_zmq.h:45:10: fatal error: 'php.h' file not found
#include "php.h"
^~~~~~~
1 error generated.
make: *** [zmq.lo] Error 1
ERROR: `make' failed
where can I generate and include this php.h file?
php-v shows: PHP 7.1.7 (cli) (built: Jul 15 2017 18:08:09) ( NTS )
phpize -v shows: grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
I ran into this when installing zmq on MacOS 10.14.3 Mojave. I'd done the followings and it's fixed.
install the command line tools if you haven't done so.
xcode-select --install
install the header files
cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg
Credit to #Steven Installing xdebug on MacOs Mojave - 'php.h' file not found

How to install Imagick extension on Windows PHP 7.0

I need to install Imagic extension on my Apache - PHP 7.0 server. I followed very nice guide located here: https://herbmiller.me/2016/06/16/installing-imagick-php-7/. Based on "php -i" out:
PHP Version => 7.0.13
Compiler => MSVC14 (Visual C++ 2015)
Architecture => x86
Thread Safety => enabled
extension_dir => D:\Program Files (x86)\PHP7\ext => D:\Program Files (x86)\PHP7\ext
I downloaded file
php_imagick-3.4.3rc4-7.0-ts-vc14-x86.zip
from http://windows.php.net/downloads/pecl/releases/imagick/3.4.3rc4/. I coppied all DLL files to D:\Program Files (x86)\PHP7\ext and I added
extension=php_imagick.dll
to my PHP.INI. When I restarted my Apache, Imagic extension was not loaded and Event viewer showed 2 same errors:
The description for Event ID 4 from source PHP-7.0.13 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
php[11628]
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\Program Files (x86)\PHP7\ext\php_imagick.dll' - The specified module could not be found.
("d:\Program Files (x86)\Apache24\bin\httpd.exe" -k runservice)
Please, could anybody tell me, what I am doing wrong?
This is the only tutorial that worked our for me:
https://tektriks.com/a-step-by-step-guide-on-how-to-install-imagemagick-in-windows/
I am using PHP version 7.1.9 with WampServer64 under Windows 7.
Follow the steps from the given tutorial:
https://herbmiller.me/2016/06/16/installing-imagick-php-7/
The file I downloaded was ImageMagick-6.9.3-7-vc14-x64.zip
http://windows.php.net/downloads/pecl/deps
Install ImageMagick to a directory of your choice
Extract the whole of the bin directory from the ImageMagick zip file to a directory of your choice. I chose C:\ImageMagick-6.9.3-7
Then set system environment variables and reboot.
Follow the instructions on https://mlocati.github.io/articles/php-windows-imagick.html
Essentially:
downloading and unpacking two ZIP files
copy some files into the PHP installation
change php.ini
restart the web server
This step worked perfectly for me.
First of all, download from below link.
-Install the ImageMagick PHP extension in Windows
Extract from php_imagick-….zip to the ext directory the
php_imagick.dll file of your PHP installation
Extract from ImageMagick-….zip to the root PHP directory (where
php.exe resides) the DLL files that start with (and there are a TON):
CORE_RL_
IM_MOD_RL_
Add this line to your php.ini file
extension=imagick
And then to run a simple test (should output a 1):
php -r "print(class_exists('imagick'));"
References:
https://github.com/Imagick/imagick/issues/224#issuecomment-367532736

How to install eAccelerator for XAMPP on Mac OS X 10.7 Lion

I had some problems installing eAccelerator on XAMPP installation of Mac OS X Lion.
Firstly, I had this problem:
Mohd-Yusufs-MacBook-Pro:APC-3.1.9 mohdyusuf$ $PHP_PREFIX/bin/phpize
grep: /Applications/XAMPP/xamppfiles/include/php/php-5.3.1/php/main/php.h: No such file or directory
grep: /Applications/XAMPP/xamppfiles/include/php/php-5.3.1/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/XAMPP/xamppfiles/include/php/php-5.3.1/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
So I solved it by installing "Developer package" from XAMPP download page.
Then, I had problems with compiled version of eAccelerator:
PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/eaccelerator.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/eaccelerator.so, 9): no suitable image found. Did find:
/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/eaccelerator.so: mach-o, but wrong architecture in Unknown on line 0
How to solve it?
Under eAccelerator source dir:
make clean
./configure CFLAGS='-arch i386' APXSLDFLAGS='-arch i386' --enable-eaccelerator=shared --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config
make
sudo make install
Ps: dont forget to enable eaccelerator.so extention under /Applications/XAMPP/xamppfiles/etc/php.ini

Categories