I am on a 64bit Fedora 17 box, PHP5.4.8. I have Oracle Instant Client 11.2 installed. I am trying to install the pdo_oci package and I'm running into some issues.
I have the latest PDO_OCI package. I unpacked it and executed the following:
~$ > cd ../PDO_OCI-1.0
~$ > phpize
~$ > ./configure --with-pdo-oci=instantclient,/usr/lib/oracle/11.2/client64/lib
I get the error message:
"I'm too dumb to figure out where the include dir is in your instant client install"
As suggested by the pdo_oci manual in php.net, I created couple of paths with the minor version of the OIC as such
ln -s /usr/bin/include/oracle/11.2 /usr/include/oracle/11.2.0.1
Still I get the same error message. Does anybody have any idea?
The machine I'm running this on is not connected to the internet, so I have to run the installation using the previously downloaded packages.
I was running into the same problem. I an running centos 6.5 64bits, but fedora is a lot similar.
Supposing you already installed both basic and devel packages:
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.i386.rpm
You should specify just the "/usr" directory, as the configure looks for oci.h in this way in configure:
$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h
so, after editing config.m4 to be able to do a 11.2 install (reference for the url in the end), do this:
./configure --with-pdo-oci=instantclient,/usr,11.2
I followed this tutorial:
http://shiki.me/blog/installing-pdo_oci-and-oci8-php-extensions-on-centos-6-4-64bit/
Related
I have php 7.4 installed on my macbook pro m1
% php -v
PHP 7.4.15 (cli) (built: Feb 26 2021 09:28:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.15, Copyright (c), by Zend Technologies
I'm trying to install the mongodb driver running:
sudo pecl install mongodb
But fails after a while:
mp/pear/temp/mongodb/src/contrib/ -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/mongodb/php_phongo.c -fno-common -DPIC -o .libs/php_phongo.o
In file included from /private/tmp/pear/temp/mongodb/php_phongo.c:29:
In file included from /opt/homebrew/Cellar/php#7.4/7.4.15_1/include/php/ext/spl/spl_iterators.h:24:
/opt/homebrew/Cellar/php#7.4/7.4.15_1/include/php/ext/pcre/php_pcre.h:25:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
^~~~~~~~~
1 error generated.
make: *** [php_phongo.lo] Error 1
ERROR: `make' failed
I tried with
arch -x86_64 sudo pecl install mongodb
but results in the same error.
Somebody knows how can I solve this please? Or if I can install the mongodb driver without using pecl. Thanks in advance.
I have finally solved my problem.
I followed these steps from https://github.com/mongodb/mongo-php-driver/issues/1159
After installing a newer PHP version where previously I used 7.3.24 and updated to 7.4.16.
Still had the same issue but diffrent file:
fatal error: 'pcre2.h' file not found #include "pcre2.h"
From this error I tried to check the files in the MacOs Big Sur File system and in the end I found where the pcre2.h is located, and oddly it was being called in the pcre folder, so I manually copied from the pcre2 folder to pcre
The solution that I used:
$cp /opt/homebrew/Cellar/pcre2/10.36/include/pcre2.h /opt/homebrew/Cellar/php\#7.4/7.4.16/include/php/ext/pcre/pcre2.h
Then, I installed mongodb using
$brew install mongodb
After that, I once again tried
$sudo pecl install mongodb
Finally, it worked. However, I'm not sure if this is a good way to solve the problem by manually adding a header file to the directory.
(Sorry I'm still new to the MacOs Environment, just bought a mac mini m1 last week for developing my programming skills)
If you were to install php multiple versions from homebrew make sure you are using the current version as you wanted to. You could check the version by using which php.
To switch from 7.4 to 5.6
$brew unlink php#7.4
$brew link php#5.6 --force
credits: https://www.markhesketh.com/switching-multiple-php-versions-on-macos/
New error
Success Installation:
There is a simpler way to fix the installation issue than symlinking the header file into PHP sources. When running pecl install, you can provide additional compile arguments via the CFLAGS environment variable. So, on the Apple Silicon platform, you can use the following command to get the extension to compile:
CFLAGS=-I/opt/homebrew/include pecl install mongodb
Note that this is only necessary on Apple Silicon, not on x64. It also works for other extensions that fail because of similar errors (e.g. apcu)
I had the same issue with PHP 7.3, I solved it just by running the following commands:
cp /opt/homebrew/Cellar/pcre2/10.38/include/pcre2.h /opt/homebrew/Cellar/php#7.3/7.3.31/include/php/ext/pcre/pcre2.h
Then installed it successfully:
sudo pecl install mongodb
I have finally solved my problem. I used PHP 8.1.7 - Mac Pro 2022 - Apple Silicon (M1)
My errors: fatal error: 'pcre2.h' file not found
The solution that I used:
1. brew install pcre2
2. ln -s /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /opt/homebrew/Cellar/php/8.1.7/include/php/ext/pcre/pcre2.h
Please check your path again when use `ln -s`
3. sudo pecl install mongodb
See more: Install pecl pear on MacOs - Link
Success Installation:
Hope it help you :) Thanks
cp /Applications/MAMP/Library/include/pcre2.h /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre/pcre2.h
then run
sudo pecl install mongodb
If you use MAMP,
Based on #Kelwin Tantono's answer follow instructions to install mongodb then,
Firstly, check for the location of pcre2.h file by
cd /opt/homebrew/Cellar/pcre2/
In this directory find the folder with ls command, in my case it was 10.40 .
Change 10.40 value in the below code with the result of ls command.
Then, check your php version with moving to php directory at MAMP by
cd /Applications/MAMP/bin/php/
Change php8.0.8 value in the below code with your desired php version.
cp /opt/homebrew/Cellar/pcre2/10.40/include/pcre2.h /Applications/MAMP/bin/php/php8.0.8/include/php/ext/pcre
Now you can install mongodb extension with below command after changing your working directory to
cd /Applications/MAMP/bin/php/php8.0.8/bin
sudo pecl install mongodb
Now, you should add extension=mongodb.so to php.ini file with
echo "extension=mongodb.so" > /Applications/MAMP/bin/php/php8.0.8/conf/php.ini
Do not forget to change php version.
Good day, everyone.
Usually I just using this Official Docs in *nix OS
But now i'm using MacOs and this instructions just doesn't work properly.
In case of pecl install cassandra I got this message:
checking for supported DataStax C/C++ driver version... awk: can't open file /include/cassandra.h
source line number 1
configure: error: not supported. Driver version 2.4.2+ required (found )
ERROR: `/private/tmp/pear/install/cassandra/configure --with-php-config=/usr/bin/php-config' failed
My logic tell me that in that case I need make DataStax C/C++ driver by my own. In folder php-driver\lib I deleting cpp-driver and using this instruction make new and fresh C/C++ driver without errors.
So in official doc it says:
Note The install.sh script will also compile and statically link into the extension a submoduled version of the DataStax C/C++ driver for Apache Cassandra. To use a version of cpp driver that you already have on your system, run phpize, ./configure and make install.
But when i trying to run ./configure from php-drive/ext I got almost the same error:
checking for supported DataStax C/C++ driver version... awk: can't open file /include/cassandra.h
source line number 1
configure: error: not supported. Driver version 2.4.2+ required (found )
Even if I continue and after that error run make install it gives me that log:
/bin/sh /Users/antvirgeo/php-driver/ext/libtool --mode=install cp ./cassandra.la /Users/antvirgeo/php-driver/ext/modules
cp ./.libs/cassandra.so /Users/antvirgeo/php-driver/ext/modules/cassandra.so
cp ./.libs/cassandra.lai /Users/antvirgeo/php-driver/ext/modules/cassandra.la
----------------------------------------------------------------------
Libraries have been installed in:
/Users/antvirgeo/php-driver/ext/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
during execution
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20121212/
cp: /usr/lib/php/extensions/no-debug-non-zts-20121212/#INST#24727#: Operation not permitted
make: *** [install-modules] Error 1
Libraries have been installed in:
/Users/antvirgeo/php-driver/ext/modules
Even if I adding cassandra extension with that path to php.ini I still got error Class 'Cassandra\SimpleStatement' not found in my project.
php -d="extension=modules/cassandra.so" -m showing that cassandra in list of PHP Modules
What am I doing wrong?
PS: I have ubuntu OS in Parallels with this project with DataStax php driver installed with this instructions works fine.
____upd:
After all instructions of #Fero without ANY ERRORS, command /usr/local/bin/php -i | grep -A 10 "^cassandra$" showing me this:
cassandra
Cassandra support => enabled
C/C++ driver version => 2.4.2
Persistent Clusters => 0
Persistent Sessions => 0
Directive => Local Value => Master Value
cassandra.log => cassandra.log => cassandra.log
cassandra.log_level => ERROR => ERROR
And still the same error - Class 'Cassandra\SimpleStatement' not found
______________UPDATED LAST:
Aaaaand it's working! I wrote output phpinfo(); in my project and realize that apache using other php version and php.ini, where wasn't extension=cassandra.so at all.
You will need to install the DataStax C/C++ driver which is a dependency of the PHP driver. Using these instructions followed by make install after the driver has been successfully built will ensure this dependency is available when building the PHP driver. Using the PHP driver build instructions you will need to make sure that GMP and PHP dev libraries are also available before running pecl install cassandra.
EDIT:
Since you are using El Capitan you are running into issues with the System Integrity Protection and you will need to disable it in order to copy files into /usr. The better and recommended option is to install PHP using Homebrew; however you can also use MacPorts if preferred.
Below are the steps used to reproduce the installation of the PHP driver on a clean OSX El Capitan image with Xcode and Homebrew already installed:
brew install autoconf cmake libuv gmp openssl pcre homebrew/php/php55
brew link homebrew/php/php55
mkdir code
pushd code
git clone https://github.com/datastax/php-driver.git
pushd php-driver
git submodule update --init --recursive
pushd lib/cpp-driver
mkdir build
pushd build
cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl ..
make -j$(sysctl -n hw.ncpu)
sudo make install
popd
popd
mkdir build
pushd ext
/usr/local/bin/phpize
popd
pushd build
../ext/configure --with-php-config=/usr/local/bin/php-config
make -j$(sysctl -n hw.ncpu)
sudo make install
popd
popd
sudo sh -c 'echo "extension=cassandra.so" >> /usr/local/etc/php/5.5/php.ini'
You can then verify the installation using the following command:
/usr/local/bin/php -i | grep -A 10 "^cassandra$"
NOTE: PHP v5.5 is utilized above since that is the default version that comes with El Capitan; PHP v5.6 and v7.0 can also be used instead.
If you need to install the Cassandra PHP extension on MacOS, you can do this simply by installing it via PECL, without having to do anything with turning on or off System Integrity Protection. I've written a blog post with easy step-by-step instructions. It also includes a link to installing PHP from Homebrew since they removed the Homebrew/php tap back in April of this year.
It also by passes the incorrect instructions given on the DataStax website. In short ...
Install Dependencies (I run these commands one at a time to easily view any messages):
$ brew install autoconf
$ brew install cmake
$ brew install automake
$ brew install libtool
$ brew install gmp
$ brew install libuv
$ brew install openssl
Retrieve and build the C++ driver and then create a build directory inside the cpp-driver folder:
$ git clone https://github.com/datastax/cpp-driver.git --depth=1
$ mkdir cpp-driver/build
$ cd cpp-driver/build
Make and build the driver with a qualified call to OpenSSL:
$ cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib ..
$ make
$ make install
Now you're good to go to install the Cassandra PHP extension libraries using PECL:
$ pecl install cassandra
Check to make sure that the Cassandra extension was added to your PHP.ini file. If not add it.
[cassandra]
extension="cassandra.so"
Restart Apache and you're off and running with Cassandra in PHP.
If you want more detail on what's happening in the above instructions, refer to my blog post here:
https://medium.com/#crmcmullen/how-to-install-the-cassandra-php-driver-on-macos-10-13-high-sierra-and-10-14-mojave-c18263831ccb
I am very new to mongoDB. I have downloaded the setup for mongoDB but before that I have to install the mongoDB PHP driver.
When I downloaded the driver I got these instruction in the documentation:
Installation
To install:
$ phpize
$ ./configure
$ make
$ sudo make install
When I run this command phpize on cmd then it gives me this error
'phpize' is not recognized as an internal or external command.
I am using:
MongoDB version 1.0
PHP version 5.5
Windows 7
I was having a similar issue a week ago. I struggled a lot and finally found that I had downloaded the wrong DLL file. (My system is 64-bit, so I downloaded the DLL for 64-bit. However, phpInfo() shows that my php is 32-bit. So, I downloaded the 32-bit DLL file and it worked!)
Have a look at the following tutorial if you still have any queries:
https://www.youtube.com/watch?v=HBKNKl5OG_8&t=356s
I hope that helps!
I have dedicated server on bluehost having CentOS 6.5 and PHP 5.4.28
I have an issue with regards to starting a service on specific port no. I log in from PuTTY as the root user, go to home/fleeton/public_html/socket, and give the following command:
php -q server.php
server.php has script to start service on port no 10000
After executing the above command, it shows me:
This example requires PCNTL extention
Can you help me what steps I need to follow to install it?
For php 5.4.x and centos 6.5 64, try this.
First you will need php-devel and gcc if don't have yet
yum install php54w-devel
If you don't have gcc
yum install gcc.x86_64
download php source code for your php version, you have installed on your server, for example php-5.4.xx.tar.gz from http://www.php.net/releases/
cd php-5.4.xx/ext/pcntl
phpize
./configure
make
copy the extension to modules folder, first find the location
php-config --extension-dir
cp modules/pcntl.so /usr/lib
I'm having a terribly difficult time getting the command "pg_connect()" to work properly on my Mac. I'm currently writing a PHP script (to be executed from console) to read a PostgreSQL database and email a report.
I've gone into my php.ini file and added
extension=pgsql.so
But, I'm met with the following error.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_pgsql.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_pgsql.so, 9): image not found in Unknown on line 0
PHP Fatal error: Call to undefined function pg_connect() in... (blah file here)
When running phpinfo(), I see nothing about PostgreSQL, so what is my issue here?
The PHP version that comes bundled with OS X doesn't include PostgreSQL. You'll have to compile the extension yourself. Here are some instructions:
Find your version of PHP: php -v.
Download the version of PHP that matches yours: curl -O http://us.php.net/distributions/php-5.3.3.tar.gz. (This example downloads PHP 5.3.3 but this must match your version)
Extract the archive you downloaded: tar -xzvf php-5.3.3.tar.gz
Change to the PostgreSQL's extension directory: cd php-5.3.3/ext/pgsql/
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Add the extension to you php.ini file by adding extension=pgsql.so. (You may already have done this)
Restart Apache.
Update for OS X Mountain Lion
Apple has removed autoconf from the newer versions of XCode so the procedure above will fail at #5. To solve that problem:
Type /usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)".
Type sudo chown -R $USER /usr/local/Cellar.
Type brew update.
Type brew install autoconf.
That should install autoconf and allow you to install the module using the instructions above.
If you use home brew, you can solve this with a command as simple as:
brew install php55-pdo-pgsql
for other php version, search with:
brew search pgsql
This worked for me with OSX 10.9.4 «Mavericks»
Install sources
Download the PHP source code. Unlike on Mountain Lion, you don’t get any headers preinstalled to link against so need to put it in /usr/include/php. Mavericks ships with PHP 5.4.17, but the latest 5.4.x source from php.net should do:
tar -jxvf php-5.4.20.tar.bz2
sudo mkdir -p /usr/include
sudo mv php-5.4.20 /usr/include/php
Configure PHP
cd /usr/include/php
./configure --without-iconv
sudo cp /etc/php.ini.default /etc/php.ini
Building a module
I needed the pdo_pgsql module - the same pattern should apply to just about any module assuming you have the necessary dependencies installed:
cd ext/pdo_pgsql
In my case I had the following error:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script. ERROR:
`phpize' failed
So I had to use this command:
brew install autoconf
Then:
phpize
After that I tried to do:
./configure
but I had the next problem:
checking for pg_config... not found configure: error: Cannot find
libpq-fe.h. Please specify correct PostgreSQL installation path
So the solution was to specify correct PostgreSQL installation path:
./configure --with-pdo-pgsql=/Library/PostgreSQL/9.3/
make
sudo make install
That copies pdo_pgsql.so to /usr/lib/php/extensions/no-debug-non-zts-20100525.
Then simply add
extension=pdo_pgsql.so to /etc/php.ini
Run php -m to confirm everything went to plan.
For those who installed php7/ngix/postgres with homebrew
You can install the PostgreSQL module with:
brew install php70-pdo-pgsql
After that, you have to restart the php service:
brew services restart php70
OS X El Capitan users can simply upgrade their version of PHP 5.6. This is a one liner that will do that.
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
For php56 via brew:
brew install php56-pdo-pgsql
PostgreSQL by default is installed in a unusual place on MAC OS X:
/Library/PostgreSQL/9.3
Given the location above you can type this:
./configure --with-pgsql=/Library/PostgreSQL/9.3
I killed the whole day trying to make it work on El Capitan after I made an upgrade yesterday and it turned out that I forgot to modify httpd.conf and change the path from the default php module (version 5.5.27) to the one I installed (version 5.6.14). This should be done in httpd.conf by modifying your default LoadModule php5_module path to LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so.
Just decided to leave it here as the potential solution for those who upgrade their OS or just the PHP version and face the same problem.
For those of you having openssl error while make here is the solution
OSX uses openssl 0.98 while installer is searching for 1.0.0
refer this link for instructions
psycopg2 installation error - Library not loaded: libssl.dylib
I downloaded PostgreSQL for Mac, and used the stack builder after installation to standup the entire EnterpriseDB Apache/PHP stack end-to-end. I mention this as a possible time saving option, probably not ideal for all situations. Should work OK if the apache and postgres shipped with Mac OS X were never started.
To keep existing apache hosted applications (i.e. pre-PostgreSQL install legacy) stable, I would just install the newer EnterpriseDB apache on port 81 (stackbuilder will prompt for new port if legacy apache instance is already running). Then, use mod_proxy in httpd.conf for the apache running on port 80 to provide seamless user experience to applications hosted on PostgreSQL.