I'm having some issues with getting mcrypt setup on my local php server. I initially tried to use homebrew, but when calling a mcrypt function, it said that it errored saying that the function was unavailable.
I tried troubleshooting a bit, but I think I accidently added mcrypt to a place other than the homebrew installed php, and now I can't seem to uninstall it, and now I can't seem to install mcrypt through homebrew anymore. I get the following error:
{php-5.3.27 tim$ brew install mcrypt
==> Downloading http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/
Already downloaded: /Library/Caches/Homebrew/mcrypt-2.5.8.tar.gz
==> ./configure --prefix=/usr/local/Cellar/mcrypt/2.5.8 --mandir=/usr/local/Cell
==> make install
Warning: Could not link mcrypt. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link mcrypt'
Possible conflicting files are:
==> Summary
šŗ /usr/local/Cellar/mcrypt/2.5.8: 12 files, 348K, built in 26 seconds}
any help would be great
thanks
The following command of ./configure is make.
and, next is make install.
./configure
make
make install
Related
This is something i've met while trying to install PHP-GMP extension.
What i was trying to do is:
Downloaded gmp with brew using brew install autoconf gmp
Downloaded PHP (i'm using version 7.3.24) from source to extract the GMP extension
Copied Gmp directory to /Applications/MAMP/bin/php/php7.3.24/include/php/ext
Entered that dir and launched phpize
Launched `./configure --with-php-config=/Applications/MAMP/bin/php/php7.3.24/bin/php-config
As soon as i hit enter it starts doing it's stuff until it says:
configure: error: GNU MP Library version 4.2 or greater required.
Once i managed to solve this somehow but i really don't know how i did it. I can only remember of downloading the gmp .tar from the official website https://gmplib.org/#DOWNLOAD but then nothing works.
Let me say that i'm a total noob with those ./configure, make and make install stuff. I don't even know what is going on so all i did was random launching hoping something good could happen:
What i've tried after downloading the official .tar is entering the folder and go with:
./configure
make && make check && make install
I've also tried to do:
export CPPFLAGS="-I/usr/local/Cellar/gmp/include"
export LDFLAGS="-L/usr/local/Cellar/gmp/lib"
as suggested here but nothing changed. I even tried to add --prefix=/usr/local/Cellar to the ./configure command but no luck.
This all story is related to this other question of me where i was trying to go on with the issue when the ./configure was still working. Now it's like i went backwards.
Sidenote: i guess it all changed when i fired brew doctor, and brew cleanup. It must have destroyed something i made that brought me back to this state
Update 23/08/2022:
As i had to go throughout all over this again i think i have some more hint to give you for future reference, here's the list:
Install GMP via homebrew (if you have an old version of homebrew or you migrated datas between Intel Mac and M1 Mac then you need to UNINSTALL homebrew and INSTALL it all over again with all the libraries)
brew install autoconf gmp
Downloading php from source is necessary, so that you can grab the /ext/gmp directory and copy inside your current PHP version folder (for me it is currently Applications/MAMP/bin/php/php8.1.0/include/php/ext/)
You need to enter inside the gmp folder that you just copied inside Applications/MAMP/bin/php/php8.1.0/include/php/ext/gmp
The command i've launched that didn't give any errors about missing GMP was:
./configure
--with-php-config=/Applications/MAMP/bin/php/php8.1.0/bin/php-config CXXFLAGS="-I/opt/homebrew/Cellar/gmp/6.2.1_1/include
CPPFLAGS="-I/opt/homebrew/Cellar/gmp/6.2.1_1/include
LDFLAGS="-L/opt/homebrew/Cellar/gmp/6.2.1_1/lib"
launch make
launch make install
IMPORTANT NOTE: M1 is arm64 architecture and if you've installed brew correctly you should have a folder /opt/homebrew/Cellar/. Instead Intel is x86_64 and the brew folder was /usr/local/Cellar/
Old answer
Ok this was quicker then i thought but i should leave it here as a reference for everyone else which will hit the same issue.
TLDR;
You need to reinstall brew for the new architecture using this arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" and then install packages with this arch -x86_64 brew install <package>.
Credits to emonz
Long version answer:
This issue all starts with brew, i don't even know why it wasn't giving me hints about this issue until just today. When i launched brew install gmp it printed this error:
which lead me to this answer from emonz. After i finally reinstalled brew i could finally get the ./configure command to work using additional args:
./configure --with-php-config=/Applications/MAMP/bin/php/php7.3.27/bin/php-config CC="gcc -arch x86_64" CXX="g++ -arch x86_64"
So basically it is all related to the new M1 chip i guess. I still don't know what i did in the past to solve this issue w/o upgrading brew to the new arch but somehow i did it. I'll leave the question and this answer more like a guide for future comers and give them hints of what they can try to solve the issue, i wish nobody go past this pain ever again.
Hello people of the internet
I am new to Linux.
I'm moving over from Windows.
I'm trying to install the PECL expect package for PHP: https://pecl.php.net/package/expect
I've followed the instructions on these pages.
But both give me errors, which I've details below:
https://www.php.net/manual/en/install.pecl.phpize.php
$ cd extname
$ phpize
$ ./configure
$ make
# make install
When I get to the ./configure, the last two lines in the terminal say:
checking specify path to Tcl needed by expect... yes, shared
checking for tcl version... configure: error: not found
I have Tcl installed, and it's the latest version.
When I try the make command it says:
make: *** No targets specified and no makefile found. Stop.
I can't find a makefile, only a Makefile.global, Makefile.fragments, and Makefile.objects
https://www.php.net/manual/en/install.pecl.pear.php
sudo pecl install expect
The last line in the terminal say:
ERROR: `/tmp/pear/temp/expect/configure --with-php-config=/usr/bin/php-config' failed
I looked on the net, and installed every dependency that others recommended, but it still doesn't work.
I've downloaded so many dependencies now, that my machine is probably not safe anymore...
Does anybody know what else I need to do to install the package?
I'm using Linux Mint 19.3.
Thanks.
I'm trying to set up gnupg for use in PHP on my mac.
I have tried following the directions found at the following links:
http://measure9.varkel.net/2013/10/building-gnupg-for-php-5-5-on-osx/
Install PHP gnupg using PECL on MAC/MAMP 10.8.4
What I seem to be running into with both is this message:
checking for gpgme_check_version in -lgpgme... no
configure: error: wrong gpgme lib version or lib not found
I see this when executing the './configure' command.
I have installed gpgme using Homebrew.
I'm a bit stuck as I've tried everything I can come up with and haven't had any luck.
I am running PHP 5.6.7 on OSX 10.10.2 using MAMP Pro.
Thank you in advance for any help you can provide.
EDIT:
My original question was unclear, so I'll try again.
I am trying to install gnupg for use in PHP in my dev environment, which is a macbook using MAMP.
I fist installed gpgme and gnpug using Homebrew, both with no issues.
Then I attempted to install gnupg using pecl via the following command
sudo pecl install gnupg
And I end up with this error message
configure: error: wrong gpgme lib version or lib not found
ERROR: `/private/tmp/pear/install/gnupg/configure' failed
I have tried editing my path with no success, adding usr/local/include and usr/local/lib, where gpgme.h and libgpgme.a files can be found. I see no change in the error message.
EDIT 2:
I believe that gpgme is being installed correctly and pecl is able to find it. I install it using the following command
brew install gpgme
If I then run the pecl command to install gnupg, I get the error message above.
Now, if I execute the brew command to uninstall gpgme
brew uninstall gpgme
I see the following error message when trying to install gnupg with pecl
configure: error: Please reinstall the gpgme distribution
ERROR: `/private/tmp/pear/temp/gnupg/configure' failed
which seems to indicate that the library is installing and being found, but it's an incorrect version.
I am unable to find any information on what version is required for pecl to install gnupg.
EDIT 3:
Looking at the terminal a little more, I see that it's failing to find a specific function (gpgme_check_version) in the lib file.
checking for gpgme_check_version in -lgpgme... no
configure: error: wrong gpgme lib version or lib not found
ERROR: `/private/tmp/pear/temp/gnupg/configure' failed
I'm not entirely sure what happened, but I believe my installation of autoconf was somehow compromised.
What ended up solving my problem was using brew to uninstall autoconf and gpgme, then using brew to reinstall both packages.
I have began installing pecl on MAMP. I have added the correct php version to the path and when which php it says /Applications/MAMP/... which is correct.
I have downloaded the Server Components and libraries moved them to a new folder in my php and run the ./configure everything seems to run ok and looked through all the checks being performed while installing and unpacking.
It gets to the last line and says;
configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>
Where should I set the <DIR> for the iconv?
Just make another folder and point it at that?
I am only trying to get the mongo pecl installed.
The information I have followed is here http://www.lullabot.com/blog/article/installing-php-pear-and-pecl-extensions-mamp-mac-os-x-107-lion
Wait wait wait wait. Why are you rebuilding your PHP installation to install the MongoDB driver?
You don't have to do that.
Just run e.g.:
/Applications/MAMP/bin/php/php7.1.1/bin/pecl install mongo
Assuming thats the full path to the pecl command part of your MAMP installation.
You might need to replace /php7.1.1/ with your current and active MAMP php version.
Working on this right now and found a workaround to just disable iconv with ./configure --without-iconv which not the best solution of course, but works for me.
Edit: Downloaded libiconv-1.14 package, and after running ./configure , make, make install, PHP configure runs fine.
This did it for me:
$ ./configure --with-iconv=/usr/lib/
First needed to install libxml2 and libxslt via homebrew though:
$ brew install libxml2
$ brew install libxslt
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.