configure: error: working directory cannot be determined - php

This is 10000x more easy on Ubuntu or Debian, but my partner who is supposed to be accustomed with CentOS absolutely wanted to use CentOS, but he didn't even know how to install PHP. So I have to do all myself.
We want to install an apache2 server with PHP, PHP-SSH2, PHP-MYSQL, PHP-GD and PHP-CURL.
So I've been trying to install PHP SSH2 on the dedicated server, but I get this error:
downloading ssh2-0.13.tgz ...
Starting to download ssh2-0.13.tgz (28,984 bytes)
.........done: 28,984 bytes
6 source files, building
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
libssh2 prefix? [autodetect] :
building in /var/tmp/pear-build-rootgdfvCp/ssh2-0.13
running: /var/tmp/ssh2/configure --with-ssh2
configure: error: working directory cannot be determined
ERROR: `/var/tmp/ssh2/configure --with-ssh2' failed
How can I fix this?

Related

Trying to install Xdebug with PHP 8.0 - The Zend Engine API version 420200930 which is installed, is newer

I've recently installed PHP 8.0 on my Ubuntu 20.04 server and I'm trying to get Xdebug working with it. I've installed it as per the directions from https://xdebug.org/wizard:
Installation Wizard
Summary
Xdebug installed: no
Server API: Command Line Interface
Windows: no
Zend Server: no
PHP Version: 8.0.0
Zend API nr: 420200930
PHP API nr: 20200930
Debug Build: no
Thread Safe Build: no
OPcache Loaded: yes
Configuration File Path: /etc/php/8.0/cli
Configuration File: /etc/php/8.0/cli/php.ini
Extensions directory: /usr/lib/php/20200930
Instructions
Download xdebug-3.0.2.tgz
Install the pre-requisites for compiling PHP extensions.
On your Ubuntu system, install them with: apt-get install php-dev autoconf automake
Unpack the downloaded file with tar -xvzf xdebug-3.0.2.tgz
Run: cd xdebug-3.0.2
Run: phpize (See the FAQ if you don't have phpize).
As part of its output it should show:
Configuring for:
...
Zend Module Api No: 20200930
Zend Extension Api No: 420200930
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
Run: ./configure
Run: make
Run: cp modules/xdebug.so /usr/lib/php/20200930
Edit /etc/php/8.0/cli/php.ini and add the line
zend_extension = /usr/lib/php/20200930/xdebug.so
Make sure that zend_extension = /usr/lib/php/20200930/xdebug.so is below the line for OPcache.
Please also update php.ini files in adjacent directories, as your system seems to be configured with a separate php.ini file for the web server and command line.
But I get this error when doing php -v:
Xdebug requires Zend Engine API version 320190902.
The Zend Engine API version 420200930 which is installed, is newer.
Contact Derick Rethans at https://xdebug.org/docs/faq#api for a later version of Xdebug.
When I ran phpize, I got this output:
Configuring for:
PHP Api Version: 20190902
Zend Module Api No: 20190902
Zend Extension Api No: 320190902
So I'm not sure what I need to do here. Why am I unable to use the right Zend API version?
Ubuntu reports that I have the lastest versions of autoconf, automake and php-dev
I had exactly the same issue. After some investigation I realized the problem was caused because the configuration path assumed during the compiling process was pointing to the global php-config (another php version). So I just had to run the compilation with the flag (Xampp in my case):
./configure --with-php-config=/opt/lampp/bin/php-config
The next steps were the same you did and it works like a charm.

PHP - Install mcrypt for PHP 7.2 and API Version 20170718

I need to install mcrypt for php on my Linux server. I have PECL, and PHP 7.2 running on API version 20170718 (i.e., all the PHP *.so extensions are loaded from /usr/bin/php/20170718). But, when I run,
pecl install mcrypt-1.0.1
It says,
Configuring for:
PHP Api Version: 20180731
Zend Module Api No: 20180731
Zend Extension Api No: 320180731
libmcrypt prefix? [autodetect] : ...
And if I install it, the wrong version gets installed, and it doesn't appear because I'm running php API version 20170717, not 20180731. In addition, including it directly from the /usr/bin/php/20180731 directory still causes it to crash since it recognizes it's the wrong API version.
How can I install the proper mcrypt version for PHP API version 20170718?

How to build mongo.so or PHP with the correct module api version

Trying to install mongoDB on my MAMP setup. I have MAMP 3.05, which comes with PHP 5.5.10. Installed mongo using the instructions from the mongo website and it seems to be running properly. Grabbed mongo extension from the mongo github page and followed their instructions for building and adding the extension to php.ini.
Everything seems ok until I restart MAMP. In php_error.log, I see this:
PHP Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
It looks like the API number for php is a later version, so it would be nice not to have to rebuild an older version of PHP. Is there a way to rebuild the mongo extension with the correct module version, or do I have to discard MAMP and build PHP manually?
Please check with the command which phpize if you use the correct version of the phpize command. This should point to a directory similar to the one you installed your PHP5 into. Mine is found in /usr/bin/phpize which is the default OS X installation.
You can further run phpize -v to check the API version it links against. In my case (the default OS X PHP installation) it outputs:
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
If the outputted API version does not match your required number 20121212 (in my case it is 20100412 which does not match) you are using the wrong phpize to configure the extension.
You have to do this first
sudo cp -r /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S‌​DKs/MacOSX10.10.sdk/usr/include/php /usr/include/php

Troubleshooting phpize script with autoconf. error when trying to configure mssql extension in PHP

I'm running Mac OS 10.8.2 and have a dev PHP (5.3.15) web server (Apache 2.2) running. I need to access a MSSQL database for a project. I have configured and installed FreeTDS successfully. I just need to 'phpize' the MSSQL extension and configure it to run with FreeTDS. When I navigate to the MSSQL directory in the terminal and try to 'phpize', I get this error:
Username-MacBook-Pro:mssql user$ phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
Is this a common OSX error and does anyone know how to fix it?
Check this solution, it worked for me: http://recensus.com/blog/technical/installing-autoconf-and-fixing-phpize-on-osx-10-8/

Loading extension apc for php5.4.6

I'm afraid I put quite a mess on my development computer and I could use some help. Basically, I had php5.3.2 on ubuntu installed with apt-get package with apc loaded as a dynamic extension.
Today, I decided to upgrade to php5.4.6 using this PPA: https://launchpad.net/~ondrej/+archive/php5. So, I run now php5.4.6 but apc won't load anymore.
So I did
pecl uninstall apc
then
pecl install apc-3.1.13
to make sure I got a version of apc compatible with php5.4.
Everythin seems to go well but the extension still won't load. It does not show on a phpinfo(). I added extension=apc.so in php.ini of course.
I think I found the origin of the problem but I don't know how to fix it:
According to my phpinfo():
PHP API 20100412
PHP Extension 20100525
Zend Extension 220100525
Zend Extension Build API220100525,NTS
PHP Extension Build API20100525,NTS
When I do, pecl install apc, I got:
54 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
As a result apc.so will be installed in /usr/lib/php5/20090626 instead of /usr/lib/php5/20100525.
How can I fix this?
Just change the API version in zend_modules.h in your php binary source to the PHP extension API number which is indicates in phpinfo().
For example if the php extension API in phpinfo() is 20100525, you must change the API number in zend_modules.h file to 20100525 and then recompile your project.
I found a way to fix that. A simple
sudo apt-get install php-apc
will do the trick.

Categories