How To Install PECL YAML Extension on Mac? - php

My goals is to be able to use the PHP functions for parsing YAML detailed in the PHP docs:
http://php.net/manual/en/ref.yaml.php
To install the PECL yaml extension I've opened Terminal and typed:
brew install libyaml
Then
sudo /usr/local/php5/bin/pecl install pecl_http
Then
sudo /usr/local/php5/bin/pecl install yaml
But I think it fails to install the PECL yaml extension. It says:
3 warnings and 16 errors generated.
make: *** [yaml.lo] Error 1
ERROR: `make' failed
And when I try to use yaml_parse_file() in my program, it says:
Fatal error: Call to undefined function yaml_parse_file()
How do I properly install the PECL yaml extension so I can use the PHP functions for parsing YAML?

I had similar issue and below steps helped me.
First be sure you have installed yaml extension (as I know since brew will not help us for packages so better to use pecl)
Even though some errors (such as failed for mkdir) occurred during installation it was completed.
pecl install yaml
Next open your php.ini file and add this line according to your path to yaml.so file.
extension=/usr/local/Cellar/php70-yaml/2.0.0/yaml.so
Hope it helps..

Related

Error on installing Mediawiki 1.38 for personal use in MacOS. Error message : Installing some PHP extensions is required. Please install: intl

I'm using MacOS Big Sur 11.4 and XAMPP 7.4.29. I have only basic knowledge on php and html. I want to go through mediawiki installion on my Mac for personal use. I encounter error message like screenshot below which basically I need to install intl extention in my PHP
I followed the instruction given here
Brew install autoconf
Change the path PATH=”/Applications/XAMPP/xamppfiles/bin:${PATH}”
Go inside the folder cd ext/intl/
Build /Applications/XAMPP/bin/phpize
I encounter error message
Cannot find config.m4. Make sure that you run '/Applications/XAMPP/bin/phpize' in the top level source directory of the module
After that I found a stackoverflow pages here addressing the issue of config.m4 and suggesting to
Install xdebug-2.6.1 (which was written 9 years ago and I can not find in internet)
Finding the file ls config* which I try and fail too
After that, I try to find other way to install the missing extention of php. I found this stackoverflow article. I followed the instruction
brew install icu4c
sudo pecl update-channels
sudo pecl install intl . In this step I put the path of ICU /opt/homebrew/opt/icu4c/
I stucked with an error message like below
/private/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/pear/temp/intl/php_intl.h:33:10: fatal error: 'unicode/ubrk.h' file not found
#include <unicode/ubrk.h>
^~~~~~~~~~~~~~~~
1 error generated.
make: *** [php_intl.lo] Error 1
ERROR: `make' failed
So that's all the thing that I have tried so far. My question since from the beginning has not been solved. How can I install the missing PHP extention so that I can proceed with the installation of mediawiki?
Thank you in advance

Error installing MongoDb PHP driver with XAMPP on Max OS Lion

I get this error when i try to run following command
sudo pecl install mongo
Error:
...php_mongo.c:22:10: fatal error: 'php.h'
file not found
#include <php.h>
^
1 error generated.
make: *** [php_mongo.lo] Error 1
ERROR: `make' failed
I am new to MAC, please help me to resolve this and get Mongo Working with PHP.
I have installed MacPorts and autoconf
It seems, that you did not install the xampp "Developer Package", required to build additional php extension. You can download the "Developer Package" from:
http://www.apachefriends.org/en/xampp-macosx.html#849
This has already been answered.
Please follow the processes outlined in this answer - Install PECL on Mac OS X 10.6.
I followed the process outlined here http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/, referenced by the above Stackoverflow link and the process for install pear, followed by pecl and subsequently -
sudo pecl install mongo
works perfectly on OSX Lion.
You may need to modify the extensions in /etc/php.ini, however, this is explained in the output after you install the php mongo driver.
It took me the whole day to find this answer, I had tried everything, but this worked finally:
sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include /Applications/XAMPP/xamppfiles/bin/pecl install mongodb
I found this article very helpful. Saved a lot of time after I wasted a lot of time to check other links. I did for MAMP and think will work for XAMPP too.
The thing is MAMP does not ship with all PHP sources to compile pecl mongo file and create mongo.so. All what you need is download php for respective version you are using. I was using php version 5.6.10. I checked php.net site that was having 5.6.13 version. I downloaded sources for this version from PhP.net. Executed "sudo pecl install mongo" again and it worked.

Install fileinfo php extension

As the fileinfo is moved from PECL to PHP. What is the best way to install it through WHM or putty.?
I tried following command:
pecl install fileinfo
and received following error:
WARNING: "pear/Fileinfo" is deprecated in favor of "channel://php-src/ext/fileinfo/in php sources
"WARNING: channel "pear.php.net" has updated its protocols, use "pecl channel-update pear.php.net" to update
downloading Fileinfo-1.0.4.tgz ...
Starting to download Fileinfo-1.0.4.tgz (5,835 bytes)
.....done: 5,835 bytes
3 source files, building
running: phpize
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
ERROR: `phpize' failed
This extension is enabled by default as of PHP 5.3.0. Before this time, fileinfo was a PECL extension but is no longer maintained there. However, versions prior to 5.3+ may use the » discontinued PECL extension.
Reference:
http://www.php.net/manual/en/fileinfo.installation.php
ERROR: `phpize' failed
This error is displayed because you don't have php-devel package installed
Are you install php-devel?
phpize execute need's php-devel package. if you are on centos run the following code
yum install php-devel
I encountered this, and needed to install php-fileinfo for WHM on a VPS Dedicated server. This https://www.inmotionhosting.com/support/website/how-to-install-a-php-extension-using-easyapache-4/
was very helpful. I figured id post this for the next guy.
For me this is working
#yum install rh-php70-php-devel
https://centos.pkgs.org/7/centos-sclo-rh/rh-php70-php-devel-7.0.10-2.el7.x86_64.rpm.html

Installing PECL extension error

I downloaded a PECL extension and executed:
$ phpize
$ ./configure
The following command generated dozens of errors:
$ make
I suspect that the first two errors lead to the others:
/Users/afilina/Downloads/APC-3.1.9/apc.h:61:17: error: php.h: No such file or directory
/Users/afilina/Downloads/APC-3.1.9/apc.h:62:30: error: main/php_streams.h: No such file or directory
Here is an example of the dozens of syntax errors:
/Users/afilina/Downloads/APC-3.1.9/apc.h:69: error: syntax error before 'TSRMLS_DC'
Does anyone have pointers as to what might have happened? Installing using the "pecl" command is not an option as my PEAR installation is corrupted.
You need the PHP headers. Depending the Distro, or OS these may be found in a different manner.
In debian you need install "php5-dev":
apt-get install php5-dev
Realy i don't know how install it in Mac.

Installing Solr in a XAMPP server in a LINUX server

I try to install Solr PHP extension to my webserver. I already have an XAMPP server and I'm using PECL to install solr
$ cd /opt/lampp/bin
$ sudo ./pecl install solr-1.0.1
But I got the following error:
checking libxml2 install dir... /usr/lib
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
ERROR: `/tmp/pear/temp/solr/configure --enable-solr=yes --enable-solr-debug=no --with-curl=
/usr --with-libxml-dir=/usr/lib' failed
During the installation it prompts me to input a path:
libxml2 install prefix [/usr] :
I have tried with enter and the /usr/lib
What shall I input there to not get an error? Or how shall I install to not get an error?
Now I have libxml2 installed through yum install libxml2-devel. But I got some wierd errors now. Here are just a few of them, it ends with:
no such parameter
/tmp/pear/temp/solr/solr_types.h:388: error: declaration for parameter 'client_count' but no such parameter
/tmp/pear/temp/solr/solr_types.h:386: error: declaration for parameter 'document_count' but no such parameter
/tmp/pear/temp/solr/solr_types.h:384: error: declaration for parameter 'request_count' but no such parameter
/tmp/pear/temp/solr/php_solr.c:1185: error: expected '{' at end of input
make: *** [php_solr.lo] Error 1 ERROR: `make' failed
If you're using RHEL/Fedora/CentOS/Scientific linux then you need to install libxml2-devel
yum install libxml2-devel
I could easily install PECL Solr via my systems package manager, probably this works for you as well. I found it very easy so probably worth to share (Fedora 14):
$ sudo yum install php-pecl-solr
A little later I got php-pecl-solr-0.9.11-1.fc14.x86_64 installed, the package's fedora homepage is here.
I could locate the libxml2 version with this command:
$ locate libxml2.so
probably this is helpful as well.
Some useful links:
http://projects.mediashelf.us/projects/8/wiki/Setting_up_Fedora_and_Solr_for_use_with_ActiveFedora#Install-Solr
http://oxfordrepo.blogspot.com/2008/01/populating-search-engine-apache-solr.html

Categories