php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56685 PDO shared fails to allow pecl to install
Submitted: 2005-11-30 15:16 UTC Modified: 2013-10-15 11:54 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: phyre at rogers dot com Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 5_1 CVS-2005-11-30 OS: Debian Linux 3.1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-11-30 15:16 UTC] phyre at rogers dot com
Description:
------------
When PDO is built as a shared extension, installing its sub-modules does not work.

Reproduce code:
---------------
# pecl install pdo_mysql       
pear/PDO_MYSQL requires PHP extension "pdo" (version >= 1.0)
No valid packages found
install failed

# pecl install pdo      
Skipping package "pear/PDO", already installed as version 1.0.2
No valid packages found
install failed

# cat /etc/php.ini | grep pdo
extension=pdo.so
extension=pdo_mysql.so
extension=pdo_pgsql.so

Expected result:
----------------
It should detect the shared pdo module and allow the install of its subcomponents.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-30 15:30 UTC] phyre at rogers dot com
I'd imagine it is checking for PDO compiled statically, and not checking for the shared PDO extension.
 [2005-11-30 16:38 UTC] phyre at rogers dot com
It should be noted that this is a problem on a php 5.0 system as well.  Unless PDO was compiled statically with php, it always shows

'pdo' PHP extension is not installed
PDO_MYSQL: Dependencies failed

when pdo is clearly installed, but as a loadable extension.  Since PDO is recommended per the docs as being a loadable extension, this should probably be possible to have the pdo modules present.

It also does this on the pgsql modules, so it's the structure in general I suppose
 [2005-11-30 21:21 UTC] cellog@php.net
The best solution here is for the user to enable PDO in php.ini, and use "pear" to install it instead of "pecl".  The "pecl" command is designed for upgrading installed extensions (i.e. you want to upgrade PDO via "pecl upgrade PDO").  The "pecl" command is exactly the same as the "pear" command except it unloads php.ini, disabling all shared extensions.
 
However, if the user "re-installs" PDO via
 
pecl install --register-only PDO
 
this will fix the problem, and then "pecl install pdo_mysql" will work just fine.

However, in order for this to work, all of the PDO drivers need package2.xml containing this dependency:

<package>
 <name>PDO</name>
 <channel>pecl.php.net</channel>
 <providesextension>PDO</providesextension>
</package>

Probably the best way to do this is to run "pecl convert" for each of the drivers in CVS, add the <providesextension> dep and then start using "pecl pickle" instead of "pecl package"
 [2005-12-22 14:12 UTC] phyre at rogers dot com
# php.ini
extension=pdo.so
extension=pdo_mysql.so
extension=pdo_pgsql.so

> use "pear" to install it instead of "pecl"
Am I missing something here?
# pear install pdo_mysql
No releases available for package "pear.php.net/pdo_mysql" - package pecl/pdo_mysql can be installed with "pecl install pdo_mysql"
Cannot initialize 'pdo_mysql', invalid or missing package file
Package "pdo_mysql" is not valid
install failed



> exactly the same as the "pear" command except it
> unloads php.ini, disabling all shared extensions.
And the different repositories as mentioned above.
 
> However, if the user "re-installs" PDO via
I think again, I must be missing something
# pecl install --register-only PDO
downloading PDO-1.0.2.tgz ...
Starting to download PDO-1.0.2.tgz (49,810 bytes)
.............done: 49,810 bytes
install ok: channel://pear.php.net/PDO-1.0.2
# pecl install pdo_mysql          
pear/PDO_MYSQL requires PHP extension "pdo" (version >= 1.0)
No valid packages found
install failed


Likely something is missing in this setup.  All goes well when you compile pdo as static, but of coures that's not the recommended way of doing this.  Plus it still won't let you upgrade pdo itself nor its modules.  I'd imagine something needs to be registered with a new installation or that some dependency tracking information is missing.
 [2006-01-22 06:09 UTC] miki at canaan dot co dot il
Same here on Debian Sarge Stable, using dotdeb.org binaries ( --disable-pdo )

pear install http://pecl.php.net/get/PDO_MYSQL-1.0.1.tgz
.....
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext
checking for PHP extension directory... /usr/lib/php5/20050922
checking for PHP installed headers prefix... /usr/include/php5
......
checking for MySQL support for PDO... yes, shared
......
checking for PDO includes... checking for PDO includes... /usr/include/php/ext
configure: error:
You've configured extension pdo_mysql, which depends on extension pdo,
but you've either not enabled pdo, or have disabled it.

rolling back 3 file operations
+ rm /usr/share/php/docs/PDO_MYSQL/.tmpCREDITS
ERROR: `/tmp/tmpyp8IMe/PDO_MYSQL-1.0.1/configure' failed

#ls -l /usr/include/php/ext
total 0
drwxr-xr-x  2 root root 112 Jan 22 12:24 pdo


# tail /etc/php5/cli/php.ini
; End:
extension=curl.so
extension=gd.so
extension=mysql.so
extension=pgsql.so
extension=pdo.so


Same error when i try:
pear install http://pecl.php.net/get/PDO_PGSQL-1.0.1.tgz

Cheers
 [2006-01-27 02:22 UTC] mastabog at hotmail dot com
I'm pulliing my hair out with this :(

I tried cellog's hint but didn't work. I even tried nasty things like removing the pdo dependency and forcing compilation ... still no luck.

This really needs to be addressed especially since it has been reported quite some time ago ... Untiil then, I guess we should recompile php with static pdo (I too am using the dotdeb packages).
 [2006-01-27 04:29 UTC] sniper@php.net
It usually helps if the shared extension something depends on is actually loaded in the php.ini PHP CLI uses..
 [2006-01-27 09:12 UTC] phyre at rogers dot com
Whoa?  The move to bogus?  The extension is in php.ini and is loaded if I do phpinfo on the CGI version (see below)

Except the final two comments, which I don't think this is the place for, this is the furthest thing from 'bogus'.



Following the directions, having loading the pdo extension and pdo_mysql and pdo_pgsql extensions, still gives those errors.  Note the first comment that has 'cat /etc/php.ini | grep pdo' and shows those being loaded.  Now whether pecl and pear commands load them is irrelevant, as that's how you're telling users to upgrade these packages.

There is a problem with the dependencies of the pdo modules with pdo, in that they can't detect pdo when installing.



# pecl upgrade pdo
Skipping package "pear/PDO", already installed as version 1.0.2
No valid packages found
upgrade failed

# pecl upgrade pdo_mysql
pear/PDO_MYSQL requires PHP extension "pdo" (version >= 1.0)
No valid packages found
upgrade failed

# pear upgrade pdo_mysql
No releases available for package "pear.php.net/pdo_mysql" - package pecl/pdo_mysql can be installed with "pecl install pdo_mysql"
Cannot initialize 'pdo_mysql', invalid or missing package file
Package "pdo_mysql" is not valid
upgrade failed

# php -i | grep pdo --after-context=1 | grep -v configure
pdo_mysql
PDO Driver for MySQL, client library version => 4.1.11

<-- seems to be loaded in the command line version.



In any case, pecl and/or pear CAN NOT properly upgrade a pdo installation when it is built shared using --enable-pdo=shared per the documentation's recommendation.  This seems to affect all sub-modules (tried on pgsql and mysql and sqlite).
 [2006-02-08 12:00 UTC] phyre at rogers dot com
Any progress on this issue?  It prevents installing and upgrading PDO's child modules.  pecl doesn't work, pear doesn't work, having it loaded in php.ini doesn't work, having it not doesn't work.  Obviously there's some dependency that isn't being worked here.
 [2006-02-13 02:57 UTC] miki at canaan dot co dot il
The only way I found to go around the problem, is to compile php by your self with PDO support.

Thats sucks, but thats life
 [2006-02-21 10:50 UTC] alex at deanspot dot org
I have a similar issue on Debian testing (etch).  I installed php5 via apt, then built PDO from source as a shared module.  This all worked fine.

Building pdo-mysql failed with the message :
>configure: error:
>You've configured extension pdo_mysql, which depends on extension pdo,
>but you've either not enabled pdo, or have disabled it.

This is definitely wrong.  phpinfo() shows PDO enabled.  I am thinking I now need to go back and recompile PHP with PDO statically.  Someone should put a note about this on http://us2.php.net/pdo, because it's not working as advertised.
 [2006-03-01 20:17 UTC] cal at calevans dot com
Any progress? Same problem on CentOS. (Not that this is an OS related issue)

pecl install pdo 

works fine

pecl install pdo_mysql

blows chow.

=C=
 [2006-03-06 13:42 UTC] miki at canaan dot co dot il
Sadly no one do anything.

I know you all ( the contributors ) volunteer, but at least let us know if its a wide known problem or something local that hit small percent users using specific settings.

we would also like to hear if someone working on it now or will in the near feature.

We don't demand it, we just want to know if we can relay on PDO as a solution in the near feature.
 [2006-03-07 15:19 UTC] jerome at macsaresexy dot com
I got a fix, it's a definite hack to phpize and removing the code that's always breaking.

find PHP_ADD_EXTENSION_DEP inside /usr/lib/php5/build/acinclude.m4 (or wherever yours is located)

and REMOVE this snippet from that function:
  if test "x$is_it_shared" = "x" && test "x$3" != "xtrue"; then
    AC_MSG_ERROR([
You've configured extension $1, which depends on extension $2,
but you've either not enabled $2, or have disabled it.
])
  fi

I don't know why it fails but removing it will allow successful configure of PDO_MYSQL and friends, this wasn't a problem in 5.1.1 i read also.
 [2006-03-12 02:41 UTC] miki at canaan dot co dot il
Thanks man, you made my Day
 [2006-03-13 12:31 UTC] james at jamesbooker dot co dot uk
I, too was having the same problem - I found an easy workaround:

#pear install pdo
....
#pecl download pdo_mysql
#tar xvzf PDO_MYSQL-1.0.1.tgz
#mv package.xml PDO_MYSQL-1.0.1
#cd PDO_MYSQL-1.0.1

edit the package.xml file, find and remove the line that says:

<dep type="ext" rel="ge" version="1.0">pdo</dep>

voila.

Now all I have to do is work out why it thinks mysql isnt installed....
 [2006-03-13 12:43 UTC] james at jamesbooker dot co dot uk
You need $SED environment variable set to point to sed (in my case, /bin/sed) then it all works after my mod above.
 [2006-03-13 15:44 UTC] phyre at rogers dot com
Okay- We have a few solutions (all hacks in a way), and this should be an easy problem to fix.  PDO is an amazing solution and needs to be taken seriously by hosts, which means it needs to be simple to install, upgrade, and use.  It simplifies application development.

Can we get some of these solutions or a less hacky one into the PECL script, or the xml files for PDO?
 [2006-06-01 18:17 UTC] jakub dot suchy at logios dot cz
Another workaround:

edit configure and about line 5712 comment these lines:
<pre>
  if test "x$is_it_shared" = "x" && test "x" != "xtrue"; then
    { { echo "$as_me:$LINENO: error:
You've configured extension pdo_sqlite, which depends on extension pdo,
but you've either not enabled pdo, or have disabled it.
" >&5
echo "$as_me: error:
You've configured extension pdo_sqlite, which depends on extension pdo,
but you've either not enabled pdo, or have disabled it.
" >&2;}
   { (exit 1); exit 1; }; }
  fi
</pre>
 [2006-06-07 22:44 UTC] rfoster at omniversesoftware dot com
I too am having the same problems trying to get specific PDO database extensions loaded in PHP 5.1.2 using Dapper Drake Ubuntu.  

Just to let you know, this stuff works fine in Windows. Maybe that will motivate somebody. ;-)
 [2006-06-09 15:02 UTC] rfoster at omniversesoftware dot com
I got the PDO extensions loaded that I needed.  Here's a link that describes the necessary steps for loading a PECL extension:  
http://us2.php.net/manual/en/install.pecl.phpize.php

For PDO_PGSQL-1.0.2 and PDO_DBLIB-1.0 it worked without a hitch.
 [2006-07-02 10:15 UTC] mst at actcom dot co dot il
Easiest solution for you guys:

PHP_PDO_SHARED=1 pecl install PDO_xxx

If that doesn't work, try unpacking the package, moving package.xml into the unpacked directory and doing

PHP_PDO_SHARED=1 pecl install package.xml
 [2006-08-02 11:36 UTC] anon at no dot where
works great thanks
 [2006-09-10 07:17 UTC] voltagex at gmail dot com
PHP_PDO_SHARED=1 pecl install pdo_mysql
worked fine for me, whereas without the SHARED=1, it failed with the errors described above.
 [2006-09-21 02:45 UTC] anonymous at example dot com
PHP_PDO_SHARED=1 pecl install pdo_sqlite

Works for me. Thanks!
 [2006-12-13 06:29 UTC] artiom1st at yahoo dot com
PHP_PDO_SHARED=1 pecl install pdo_mysql

result:

downloading PDO_MYSQL-1.0.2.tgz ...
Starting to download PDO_MYSQL-1.0.2.tgz (14,778 bytes)
.....done: 14,778 bytes
downloading PDO-1.0.3.tgz ...
Starting to download PDO-1.0.3.tgz (52,613 bytes)
...done: 52,613 bytes
12 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
ERROR: `phpize' failed
7 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
ERROR: `phpize' failed
 [2007-01-25 22:15 UTC] sean at the-murrays dot net
I tried  PHP_PDO... but it didn't like the fact I wasn't root.  Using Ubuntu, I naturaly put sudo in front of it, but that failed.  The trick I did here was to put the line in a file i.e. pdo_sqlite, then I entered

sudo sh pdo_sqlite ... which worked.

Thanks for the help
 [2007-06-29 15:39 UTC] c_petro at yahoo dot com
sometimes configure cannot find the mysql_config file.  Try doing:

#ln -s /path/to/mysql/bin/mysql_config /usr/bin/mysql_config
#pecl install pdo_mysql

that's it
 [2007-08-09 16:34 UTC] nlgordon at gmail dot com
With php 5.2.0 and higher this becomes more troublesome in that doing `pecl upgrade pdo` will always downgrade the pdo extension.  This removes the ATTR_DEFAULT_FETCH_MODE constant from the class as well as other fixes in the latest version of the PDO module.  Updating pecl with the latest version of what is in the stable 5.2.x tree would solve this problem.
 [2007-11-21 14:16 UTC] anonymous_two at example dot com
Had problems with shared module for PDO, was googling around and found this page ;) This worked for me:

1. pecl uninstall PDO_MYSQL
2. PHP_PDO_SHARED=1 pecl install PDO_MYSQL
 [2009-05-31 21:51 UTC] Jakub at Horky dot earth
Here is a fix.

You don't need to install PDO extension provided by pecl if 
pdo package is contained in your distribution (e.g. Debian) 
itself.

In PEAR directory, edit your Dependency2.php file - add this 
line at the beginning of extension_loaded() function:

---
        dl("$name.so");
---


Or, if you want to be more precisious, you can add these 
lines instead:

---
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $prefix = 'php_';
            $suffix = '.' . ( defined('PHP_SHLIB_SUFFIX') ? 
PHP_SHLIB_SUFFIX : 'dll' );
        } else {
            $prefix = '';
            $suffix = '.' . ( defined('PHP_SHLIB_SUFFIX') ? 
PHP_SHLIB_SUFFIX : 'so' );
        }
        @dl($prefix . $name . $suffix);
---

Have a nice day
 [2013-06-12 02:01 UTC] ssufficool@php.net
-Status: Open +Status: Feedback -Package: PDO +Package: *General Issues
 [2013-06-12 02:01 UTC] ssufficool@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC