sybase_* functions missing in php5-sybase for hardy

Bug #240519 reported by Paul McLanahan on 2008-06-16
26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Wishlist
Unassigned
Hardy
Undecided
Chuck Short

Bug Description

Binary package hint: php5

When trying to run php programs on hardy server that use the sybase_* php functions, I get the following error:

Fatal error: Call to undefined function sybase_connect()

The sybase_* functions should be installed via the php5-sybase package, but instead only the mssql_* functions are installed. I realize that they are merely aliases to one another, but according to the php5 documentation, the mssql functions are aliases to the sybase ones. So if one set needs to go away, it would make more sense to get rid of the mssql rather than the sybase functions, especially considering the name of the package.

The error is seen when using php5 from the cli or through apache2.

My package version: php5-sybase 5.2.4-2ubuntu5.1

Ubuntu Version: Ubuntu 8.04

Chuck Short (zulcss) wrote :

Thanks for the bug report. I will look into this and get back to you.

Regards
chuck

Changed in php5:
status: New → Triaged
Chuck Short (zulcss) wrote :

Hi

Thanks for the bug report. According to the changelog that was the intention. Since mssql functions are alias to sybase functions you can mssql functions to access sybase databases in php. I will have a look at breaking the package into php5-sybase and php5-mssql for intrepid. However I dont think think this will get fixed for hardy unfortunately.

Regards
chuck

Changed in php5:
importance: Undecided → Wishlist
Paul McLanahan (pmclanahan) wrote :

Thanks for your help Chuck.

I just can't believe that Ubuntu would be ok with leaving out documented and supported features of included software. This is the 5 year supported LTS version of the OS. Are you really saying that the php5 package will remain broken for 5 years?

http://us3.php.net/manual/en/aliases.php

That doc clearly says that the mssql_* functions are the aliases. How can you leave in the alias functions and remove the masters? I don't even understand how that's possible, much less desirable.

I've counted on Ubuntu packages for years, but if the directive is to now treat complete feature removal with so little care or oversight, then I'll have to look elsewhere for my server platforms.

Please tell me I'm wrong.

Chuck Short (zulcss) wrote :

Ill try to cook somehting up.

Thanks
chuck

http://us3.php.net/manual/en/aliases.php

>
> That doc clearly says that the mssql_* functions are the aliases. How
> can you leave in the alias functions and remove the masters? I don't
> even understand how that's possible, much less desirable.

This document is wrong. Feel free to report bug at php. It's true for
sybase_ct extension, but not for mssql based function. Anyway I thought that
Steve aliased sybase_* to mssql_* when he made this transition in Debian. I
wonder why he hasn't do it.

> I've counted on Ubuntu packages for years, but if the directive is to
> now treat complete feature removal with so little care or oversight,
> then I'll have to look elsewhere for my server platforms.

Please don't be hysterical. Attached patch should do the trick. For now you
can just download php sources, go to ext/mssql, apply patch, install
php5-dev, run phpize && configure && make && make install. Full recompile of
php is not neccessary.

BIG WARNING: I didn't test the patch. Use at own risk, I don't even now if
it compiles (it should, but who knows).

--
Ondřej Surý <email address hidden>

Paul McLanahan (pmclanahan) wrote :

Thanks for the help Ondřej. I didn't mean for that to sound hysterical. I'm just trying my best not to have to find and refactor TONS of code or install php5 from source. I know it wouldn't be that difficult to build from the php official sources, but I don't want to deal w/ the package maintenance dependency problems that would come from having to remove the php5 package.

Thanks a lot for the patch. I'll let you know how it goes.

Chuck Short (zulcss) wrote :

Can you try the version from my ppa? http://launchapd.net/~zulcss/+archive

Thanks
chuck

Paul McLanahan (pmclanahan) wrote :

Solution:

Ok... so I installed the php5 source package

apt-get source php5

I decided to just give the extension in ext/sybase a try before applying any patches.

cd ext/sybase
phpize && configure && make && sudo make install

After that it was a simple matter of adding a sybase.ini file to /etc/php5/conf.d with the contents

extension=sybase.so

I then restarted apache2 and it works :)

I'm still a bit confused as to why the php5-sybase package installs the mssql.so module, and the php5-mssql package is a virtual for php5-sybase. But it is working for me now, and hopefully the people who need this info can find it here.

Thanks again for the help Ondřej and Chuck!

Paul

Ondřej Surý (ondrej) wrote :

Well,

you solution is working, but wrong one. The real reason why sybase module
installs mssql.so is they are really (almost) the same - they use same
library to access database. With one small exception - mssql module is
better maintained and provides pdo version, and works better in some cases.
That was reason to do the switch in Debian.

I am not really sure why Steve didn't provide aliases from sybase to mssql
function, but my patch should ensure it. I'll commit it into Debian svn and
it will propage into next version of Ubuntu as well.

Ondrej.

2008/6/18 Paul McLanahan <email address hidden>:

> Solution:
>
> Ok... so I installed the php5 source package
>
> apt-get source php5
>
> I decided to just give the extension in ext/sybase a try before applying
> any patches.
>
> cd ext/sybase
> phpize && configure && make && sudo make install
>
> After that it was a simple matter of adding a sybase.ini file to
> /etc/php5/conf.d with the contents
>
> extension=sybase.so
>
> I then restarted apache2 and it works :)
>
> I'm still a bit confused as to why the php5-sybase package installs the
> mssql.so module, and the php5-mssql package is a virtual for
> php5-sybase. But it is working for me now, and hopefully the people who
> need this info can find it here.
>
> Thanks again for the help Ondřej and Chuck!
>
> Paul
>
> --
> sybase_* functions missing in php5-sybase for hardy
> https://bugs.launchpad.net/bugs/240519
> You received this bug notification because you are subscribed to php5 in
> ubuntu.
>

--
Ondřej Surý <email address hidden>

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package php5 - 5.2.6-1ubuntu2

---------------
php5 (5.2.6-1ubuntu2) intrepid; urgency=low

  * debian/patches/119-sybase-alias.patch:
    - Fixes missing sybase support. (LP: #240519)

 -- Chuck Short <email address hidden> Wed, 18 Jun 2008 19:53:32 +0000

Changed in php5:
status: Triaged → Fix Released
Paul McLanahan (pmclanahan) wrote :

More results:

Chuck: I tried your version from you ppa, but unfortunately it looks like that build failed.

Ondřej: I tried your patch, but the compile failed with what appeared to be references to undefined functions in the alias declarations. So I decided to give it a try myself. I simply coppied the function declarations from the area that you originally patched, modified them to become alias declarations, and added them after the function declarations. It's the same thing you did, except some how some extra functions got in there that were never declared. I then wrapped that in the #if statement you used and compiled and installed. It's now working wonderfully. Hopefully it will remain that way.

I've attached my version of the patch.

Thanks very much to both of you for your excellent help.

Chuck Short (zulcss) wrote :

Hardy introduced a regression that prevents sybase users from using php5-sybase on hardy. This is due to a change in the packaging between hardy and gutsy. Attached to this bug report is the patch that fixes the issue.

TEST CASE:

1. Install php5-sybase with a sybase database.
2. Try to use php5-sybase with an actual sybase database.

Please note it would be easier for people who have sybase already installed to test this SRU.

I have attached the patch that fixes this issue. If you have any questions please let me know.

Chuck Short (zulcss) wrote :
Martin Pitt (pitti) wrote :

Accepted into -proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in php5:
status: New → Fix Committed
Paul McLanahan (pmclanahan) wrote :

I successfully upgraded my php5 packages to -proposed, and everything seems to be working fine. I'll post further updates when I have them, but the sybase_* functions are indeed there and functioning properly.

Thanks again!

Fwolf (fwolfcn) wrote :

Glad to hear this, hope to see it in release version soon,
thanks for your work!

Martin Pitt (pitti) wrote :

Copied to hardy-updates.

Changed in php5:
status: Fix Committed → Fix Released
Cronje Fourie (cronje-fourie) wrote :

To those interested. It appears that all functions have not been aliased to sybase_* I got sybase to work but found out that sybase_affected_rows doesn't work. Luckily I have access to a feisty box so I grabbed the sybase_ct.so from there.

Would be great if these aliases could be added as well :) so that I don't have to go through the copy paste procedures again.

Martin Pitt (pitti) wrote :

Chuck, can you please have a look? Thanks!

Changed in php5:
assignee: nobody → zulcss
status: Fix Released → Confirmed
Adam Conrad (adconrad) wrote :

The reason sybase_affected_rows didn't get aliased is because this was renamed in the mssql extension to mssql_rows_affected, so the s/mssql/sybase/ aliases didn't catch that.

To get old sybase_ct users happy, you need to add an alias like so:

PHP_FALIAS(sybase_affected_rows, mssql_rows_affected, NULL)

Fole (fole) wrote :

Attached is the updated patch file.

knb (knb) wrote :

Can't you module maintainers (ubuntu or debian) just simply release TWO modules php5-sybase and php5-mssql that work properly ?

Please abandon putting two different functionalities into one php5 module.

It is confusing and inconsistent.

In the past php developers had to use Module sybase_ct to connect to mssql servers (gaining only a small subset of the features mssql server supports), now its the other way around, you need to include php5-mssql to access Sybase ASE databases. Though with mssql now having priority we Sybase developers have even less features of the sybase connectivity than before, e.g. no Stored procedure support anymore.

Please release a module php5-sybase that handles the sybase connectivity and php5-mssql that handles the mssql connectivity.
Maybe to avoid naming conflicts, release a new version php5-sybaseASE that handles the connectivity to Sybase Adaptive Server Enterprise ASE and php5-mssql2008 that handles mssqlserver 2008 connectivity. Both should be backward compatible to other, older releases of the respective products.

It has been true in the past that sybase and mssql server shared a common code base, a common api and a common transfer protocol. However this is no longer the case for at least 10 years. SO please stop the madness of releasing a common "Sybase / MS SQL Server module for php5".

Where else should I add this Enhancement request? At ubuntu brainstorm? At debian.org somewhere?

On Mon, Sep 29, 2008 at 12:30:01PM -0000, knb wrote:
> It has been true in the past that sybase and mssql server shared a
> common code base, a common api and a common transfer protocol. However
> this is no longer the case for at least 10 years.

That's irrelevant given that there's only one library implementation in
Ubuntu that talks to both of them (FreeTDS).

Bugs in the individual PHP extensions notwithstanding, there's no reason to
ship separate packages for each server type.

knb (knb) wrote :

The common dependency of both sybase mad mssql Vendor Specific Database Extensions on FreetTDS libs might be advantageous for the package developer or maintainer, but it has disadvantages for the library users:
- if I remove the Sybase DB Extension using synaptic, I also lose the MSSQL Server connectivity.
- it is still confusing to be forced to connect to a sybase database using mssql_connect(), or to call a mssql server with sybase_connect() . - it took me some time to understand the whole issue. However it is next to impossible to communicate the situation to other web developers and new colleagues.

And what will happen if the FreeTDS developer(s) decided someday to drop compatibility for one of the server types, or too fork development?

Instead of using freetds, a linux user can still install the original C Client libraries from Sybase. As part of the ASE DB server developer trial-edition/expres-edition, these libraries are available for free but not as open-source from Sybase in 32bit and 64 bit versions.
(The 32-bit header files are available also free of charge from Sybase, whereas the 64 bit versions of the header files aren't. Here it is indeed an advantage to have a basic 64bit FreetTDS-based sybase client that works)

Seems that I have to do my php with-sybase-ct development on a different machine, than my unix box.

Speaking with my debian php maintainer hat.

If you are able to install non-free sybase libraries, you are also
able to install php5-dev and run phpize && make && make install
in sybase_ct directory.

Ie. if you want to use non-free libraries, you cannot expect help
from package distributors.

O.

2008/9/29 knb <email address hidden>:
> The common dependency of both sybase mad mssql Vendor Specific Database Extensions on FreetTDS libs might be advantageous for the package developer or maintainer, but it has disadvantages for the library users:
> - if I remove the Sybase DB Extension using synaptic, I also lose the MSSQL Server connectivity.
> - it is still confusing to be forced to connect to a sybase database using mssql_connect(), or to call a mssql server with sybase_connect() . - it took me some time to understand the whole issue. However it is next to impossible to communicate the situation to other web developers and new colleagues.
>
> And what will happen if the FreeTDS developer(s) decided someday to drop
> compatibility for one of the server types, or too fork development?
>
> Instead of using freetds, a linux user can still install the original C Client libraries from Sybase. As part of the ASE DB server developer trial-edition/expres-edition, these libraries are available for free but not as open-source from Sybase in 32bit and 64 bit versions.
> (The 32-bit header files are available also free of charge from Sybase, whereas the 64 bit versions of the header files aren't. Here it is indeed an advantage to have a basic 64bit FreetTDS-based sybase client that works)
>
> Seems that I have to do my php with-sybase-ct development on a different
> machine, than my unix box.
>
> --
> sybase_* functions missing in php5-sybase for hardy
> https://bugs.launchpad.net/bugs/240519
> You received this bug notification because you are subscribed to php5 in
> ubuntu.
>

--
Ondřej Surý <email address hidden>

knb (knb) wrote :

? I didn't expect any help. Thanks for mentioning the phpize trick-
Maybe I should have posted this on the ubuntu brainstorm site in the first place. It might be too specialized, though.

I'm just saying that the mssql / sybase PHP-DB-Extension-Module issue is more complicated than it needs to be.

Aside from that I think that the FreetTDS based perl module DBD::Sybase that comes with Ubuntu is awesome and I'm glad that I can install it out-of-the-box.

Gabriel Mazetto (brodock) wrote :

This bug report is probably related with : https://bugs.launchpad.net/ubuntu/+source/php5/+bug/21995/

this comment : https://bugs.launchpad.net/ubuntu/+source/php5/+bug/21995/comments/15 has some informations that is valid to this bug

knb (knb) wrote :

FYI:

PHP4:
sybase_min_client_severity
sybase_min_server_severity

PHP5: (similar)
sybase_min_error_severity
sybase_min_message_severity

Maybe the functions are equivalent to each other, didn't compare them thoroughly.
What I need is that I can prevent that Xdebug croaks on every tiny DB warning with this command
   sybase_min_message_severity(100);

What I did:
I searched for strings in the php5 mssql.so file using this command:
 strings /usr/src/php5-5.2.4/debian/php5-sybase/usr/lib/php5/20060613/mssql.so | grep ^sybase_ | sort -u > sybphp5.txt

and in the php4 sybase_ct.so file with
strings /opt/install/php-4.3.7/ext/sybase_ct/php_sybase_ct.o | grep ^sybase_ | sort -u > sybphp5.txt

These functions seem to be new in php5
sybase_bind
sybase_execute
sybase_fetch_batch
sybase_field_length
sybase_field_name
sybase_field_type
sybase_free_statement
sybase_guid_string
sybase_init
sybase_min_error_severity
sybase_min_message_severity
sybase_next_result
sybase_rows_affected
~

Note that PHP4 Sybase Functions
sybase_set_message_handler
sybase_unbuffered_query

seem indeed to be gone in php5

Accepted php5 into hardy-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in php5 (Ubuntu Hardy):
status: Confirmed → Fix Committed
tags: added: verification-needed
knb (knb) wrote :

Thanks for working on this. I don't have the time to do thorough testing right now. Sorry.

Martin Pitt (pitti) wrote :

Anyone who can test the proposed package? If not, the proposed update will be removed again. Thanks!

Jonathan Riddell (jr) wrote :

Removing from hardy-proposed due to lack of testing. Requested by zul on irc.

Changed in php5 (Ubuntu Hardy):
status: Fix Committed → Triaged

removing verification-needed because there nothing to test anymore.

tags: removed: verification-needed
Chuck Short (zulcss) wrote :

Im closing this as an SRU. No one has verified it as of yet.

chuck

Changed in php5 (Ubuntu Hardy):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments