Issue binding ZeroMQ to PHP In MacOS - php

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

Related

How to change phpize to current version

I'm using Mojave OS X and I've been following these steps to install Xdebug through Pecl. I'm trying to set it up so I can use the debugger of PHPStorm.
http://www.devinbaldwin.com/2018/09/27/how-to-install-xdebug-on-a-new-mac-including-mojave/
This is my current setup:
Xdebug installed: no
Server API: Command Line Interface
Windows: no
Zend Server: no
PHP Version: 7.3.6
Zend API nr: 320180731
PHP API nr: 20180731
Debug Build: no
Thread Safe Build: no
OPcache Loaded: yes
Configuration File Path: /usr/local/etc/php/7.3
Configuration File: /usr/local/etc/php/7.3/php.ini
Extensions directory: /usr/local/lib/php/pecl/20180731
I've followed all the steps but got stuck at installing Xdebug because I didn't have phpize.
I've installed the newest version of Xcode to create phpize, this worked at first, but I was having trouble appending the php.ini through PHPStorm because the file was read-only and I've thought of following another guide which talks about downgrading PHP to version 7.2 and installing Xdebug through that version, which is how this problem started.
When I tried to install Xdebug through Pecl, I've got this error.
downloading xdebug-2.7.2.tgz ...
Starting to download xdebug-2.7.2.tgz (230,987 bytes)
.................................................done: 230,987 bytes
69 source files, building
running: phpize7.2
sh: phpize7.2: command not found
ERROR: 'phpize' failed
At the sh, it never showed phpize7.2 before, it used to show phpize without the numbers.
I've tried to uninstall and reinstall homebrew and remove all php versions and installed the current php version as posted above.
I just want to know how I can revert phpsize to the current version. I've tried using PHP 7.2 but I still got the same error.
I've tried this guide since I'm using the latest PHP version, which is 7.3.
https://sys.cuquejo.org/install-php-7-3-xdebug-on-macos-mojave-with-homebrew/
But I still get the same error.
In addition, when I typed phpsize I got this:
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level
source directory of the module
However, when I typed phpsize --help
Usage: /usr/local/bin/phpize [--clean|--help|--version|-v]
Typing phpize72 --help would only show this:
-bash: phpize7.2: command not found
I'm not sure why this happened but any explanations could help.

Unable to load dynamic library 'zip.so' on Centos 7.6.1810 using remi-php72 repo

I am having problems getting October CMS to update:
Update failed
"Class 'ZipArchive' not found" on line 51 of /var/www/html/jdd/htdocs/vendor/october/rain/src/Filesystem/Zip.php
And if I do php -m, i get the following warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: undefined symbol: zip_libzip_version), /usr/lib64/php/modules/zip.so.so (/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Strange thing is, in my /etc/php.d/ folder, the zip.ini file contains the line: extension=zip.so. whereas all other .ini files in /php.d do not include the ".so" extension (eg: for the json.ini file, the line reads: extension=json). I have tried removing the ".so" from the zip.ini extension= line, but it still won't work.
As far as I know, the system is only running x86_64 executables (how do I check this with absolute certainty - all binaries are showing as .x86_64 or .noarch?).
I have tried other versions of php:
-php 5.4 installs zip.so fine (it loads correctly), except October requires at least php 7.0.
-php 7.0 to 7.3 all install zip.so, but the extension still does not load.
Can anyone help?
I've got the same problem and found following solution:
Search for installed php modules:
yum list installed | grep php*
Try to locate installed php-zip module:
rpm -ql php72-php-pecl-zip
You will see something like this:
/etc/opt/remi/php72/php.d/40-zip.ini
/opt/remi/php72/root/usr/lib64/php/modules/zip.so # <----
/opt/remi/php72/root/usr/share/doc/pecl/zip
Then just create symlink to this file in directory where php searches modules by default:
ln -s /opt/remi/php72/root/usr/lib64/php/modules/zip.so /usr/lib64/php/modules/zip.so
After this steps I finally saw zip extension in php -m output and now can use class ZipArchive.
Also you should probably restart your httpd service.
1 - Download manually the last ZIP pecl lib at https://pecl.php.net/package/zip
2 - Install it with pecl in the downloaded file
sudo pecl install zip-1.19.1.tgz
3 Enable zip on php.ini
extension=zip
Please check you are using latest libzip5 version 1.5.1 from remi-safe repository (which is mandatory, and enabled by default)

PHP Imagick problems

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

OCI8 PECL MACOS Maverik

I try install OCI8 + PHP I can access mi DB's in sqlplus
I try this
pecl install oci8
and the result is this
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:
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] :
in the scrip prompt i write this
instantclient,/usr/local/lib
But i have this problem
/private/tmp/pear/install/oci8/oci8.c:35:10: fatal error: 'php.h' file not found
#include "php.h"
^
1 error generated.
make: *** [oci8.lo] Error 1
ERROR: `make' failed
You need write the instant client path.
above download link instant client:
https://www.oracle.com/br/database/technologies/instant-client/macos-intel-x86-downloads.html

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