Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transparent switch over for deprecated mssql DB driver. #226

Open
6 tasks done
NathanGibbs3 opened this issue Jul 1, 2023 · 7 comments
Open
6 tasks done

Transparent switch over for deprecated mssql DB driver. #226

NathanGibbs3 opened this issue Jul 1, 2023 · 7 comments
Assignees
Labels
bug Something isn't working DB Database Issues DB-MsSQL Issues related to Ms SQL Server DB enhancement New feature or request invalid This doesn't seem right LCB-TechDebt Issue exists in Legacy Code Base. We inherited it. Prod Observed in Production Environment. Stability Issue impacts or is related to App Stability. Windows Issues affecting installations running on MS Windows.
Milestone

Comments

@NathanGibbs3
Copy link
Owner

NathanGibbs3 commented Jul 1, 2023

Item Description
File(s):
Class:
Function:
Similar Issues:
Depends on Issue(s):
Dependency Type:
Misc. Info.: Issue effects PHP 5.3.0+

Need: php.ini lines for enabling the following:

  • The old MySQL Driver. - Extension=mysql
  • The new Mysqli Driver. - Extension=mysqli
  • The PostgreSQL driver. - Extension=pgsql
  • The old MsSQL driver. - Extension=mssql
  • The new MsSQL driver - Extension=sqlsrv.
  • The Oracle driver - Extension=oci8.

We can detect when BASE is running on windows and issue a more appropriate error message about enabling the necessary extension.

Expected Behavior:
When $DBtype is set to mssql, transparently switch over to the sqlsrv driver.
Current Behavior:
BASE crashes.

@NathanGibbs3 NathanGibbs3 added bug Something isn't working enhancement New feature or request invalid This doesn't seem right Prod Observed in Production Environment. LCB-TechDebt Issue exists in Legacy Code Base. We inherited it. Stability Issue impacts or is related to App Stability. labels Jul 1, 2023
@NathanGibbs3 NathanGibbs3 added this to the 1.4.6 milestone Jul 1, 2023
@NathanGibbs3 NathanGibbs3 self-assigned this Jul 1, 2023
@NathanGibbs3 NathanGibbs3 added the DB Database Issues label Jul 1, 2023
NathanGibbs3 added a commit that referenced this issue Jul 2, 2023
         Closes #224 Closes #225 Closes #226
         Code Cleanup.

     File(s): base_ag_main.php
            : base_local_rules.php
            : includes/base_krnl.php
            : includes/base_net.inc.php
            : includes/base_state_citems.inc.php
            : includes/base_state_query.inc.php
              Code Cleanup.
     File(s): base_common.php
              Code Cleanup.
    Issue(s): #222
 Function(s): Removed: BuildIPFormVars(), BuildSrcIPFormVars(), &
              BuildDstIPFormVars().
 Function(s): BuildIPFormVar( ip, addr_type, criteria_instance )
              Returns HTTP Query String fragment containing IP
              Address search criteria; or empty string on invalid
              IP.
              Note: Curently the NULL_IP constant is also treated
              as valid foe backward compatibility reasons. This
              "feature" will be removed in the future, when code
              depending on NULL_IP being in the HTTP Query String
              is removed.
     File(s): base_db_common.php
            : includes/base_db.inc.php
              Code Cleanup.
    Issue(s): #226
     File(s): base_maintenance.php
            : composer.json
            : includes/base_auth.inc.php
            : includes/base_capabilities.php
              Code Cleanup.
    Issue(s): #225
     File(s): base_stat_ipaddr.php
    Issue(s): #217
              Code Cleanup.
     File(s): base_stat_uaddr.php
    Issue(s): #223
              Code Cleanup.
     File(s): includes/base_log_error.inc.php
    Issue(s): #226
 Function(s): returnBuildError( Desc, Opt, dll )
              Added dll paramater to provide more
              meaningful error reports for Windows
              installations.
     File(s): includes/base_rtl.php
              Code Cleanup.
              Bumped RTL Version to 0.0.12
    Issue(s): #224 #225
 Function(s): BCMi()
              Returns true if BCMath is installed, false otherwise.
            : GMPi()
              Returns true if GMP is installed, false otherwise.
            : IPv6i()
              Returns true if RTL can handle IPv6 on this installation.
              Sets New Constant BASE_RTL_IPv6 accordingly.
     File(s): includes/base_state_criteria.inc.php
    Issue(s): #218
Unit Test(s): Covers BuildIPFormVar(), the following in the
              CriteriaState Class, ReadState().
@NathanGibbs3 NathanGibbs3 added help wanted Extra attention is needed question Further information is requested labels Jul 2, 2023
@NathanGibbs3
Copy link
Owner Author

Ok, @mesteele, it's in the devel branch, let us know how it works.

Also, any help with getting the php.ini lines to enable other DB drivers on Windows would be helpful.

@mesteele
Copy link

mesteele commented Jul 2, 2023

Ok, @mesteele, it's in the devel branch, let us know how it works.

Also, any help with getting the php.ini lines to enable other DB drivers on Windows would be helpful.

As long as the extensions are added to the extension_dir and added as an extension= they will load.

extension_dir = "d:\winids\php\ext"

; The ldap extension must be before curl if OpenSSL 1.0.2 and OpenLDAP is used
; otherwise it results in segfault when unloading after using SASL.
; See php/php-src#8620 for more info.
;extension=ldap

;extension=curl
;extension=ffi
;extension=ftp
;extension=fileinfo
extension=gd
;extension=gettext
extension=gmp
;extension=intl
;extension=imap
;extension=mbstring
;extension=exif      ; Must be after mbstring as it depends on it
;extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=oci8_19  ; Use with Oracle Database 19 Instant Client
;extension=odbc
;extension=openssl
;extension=pdo_firebird
;extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=pgsql
;extension=shmop
extension=sqlsrv_82_ts
; The MIBS data available in the PHP distribution must be installed.
; See https://www.php.net/manual/en/snmp.installation.php
;extension=snmp

;extension=soap
;extension=sockets
;extension=sodium
;extension=sqlite3
;extension=tidy
;extension=xsl
;extension=zip

;zend_extension=opcache

@NathanGibbs3
Copy link
Owner Author

Do all the DB extensions in the extension dir follow the file naming convention of php_*.dll?

The idea is that the dll referenced in an error message for windows users will not necessarily point to the specific dll that will fix their issue, but that the suggested dll name is close enough to the solution that they can look in their extensions directory, see what they have, and hopefully figure it out from there.

For example, the sqlsrv dll can be named different things depending on PHP version built for, thread, safety, etc.
It would be impossible to recommend a specific dll file to all end users, and be sure it worked.

@NathanGibbs3
Copy link
Owner Author

The only extension dll names I'm not sure about are the old MySQL & MsSQL drivers.
They might be found on a PHP 5x installation. They were removed in PHP 7.

@mesteele
Copy link

mesteele commented Jul 4, 2023

The official MS drivers for PHP 8.x are:

php_pdo_sqlsrv_80_nts_x64.dll
php_pdo_sqlsrv_80_nts_x86.dll
php_pdo_sqlsrv_80_ts_x64.dll
php_pdo_sqlsrv_80_ts_x86.dll
php_pdo_sqlsrv_81_nts_x64.dll
php_pdo_sqlsrv_81_nts_x86.dll
php_pdo_sqlsrv_81_ts_x64.dll
php_pdo_sqlsrv_81_ts_x86.dll
php_pdo_sqlsrv_82_nts_x64.dll
php_pdo_sqlsrv_82_nts_x86.dll
php_pdo_sqlsrv_82_ts_x64.dll
php_pdo_sqlsrv_82_ts_x86.dll
php_sqlsrv_80_nts_x64.dll
php_sqlsrv_80_nts_x86.dll
php_sqlsrv_80_ts_x64.dll
php_sqlsrv_80_ts_x86.dll
php_sqlsrv_81_nts_x64.dll
php_sqlsrv_81_nts_x86.dll
php_sqlsrv_81_ts_x64.dll
php_sqlsrv_81_ts_x86.dll
php_sqlsrv_82_nts_x64.dll
php_sqlsrv_82_nts_x86.dll
php_sqlsrv_82_ts_x64.dll
php_sqlsrv_82_ts_x86.dll

PHP.ini omits the php_ and the .dll - So the extension for Windows x64 PHP 8.2 and Apache would be:

extension=sqlsrv_82_ts_x64

@NathanGibbs3
Copy link
Owner Author

NathanGibbs3 commented Jul 4, 2023

Thanks, that helped me refine the error message a bit more.
It won't point end users to the exact dll they need for their installation, but it will get them close enough to figure it out from there.

Better than compile time options for building PHP from source, which most of the time doesn't apply to the situation, especially on windows.

@NathanGibbs3 NathanGibbs3 added DB-MsSQL Issues related to Ms SQL Server DB and removed help wanted Extra attention is needed question Further information is requested labels Jul 7, 2023
@mesteele
Copy link

mesteele commented Jul 9, 2023

php-5.6.40-Win32-VC11-x64
php_mysql.dll
php_mysqli.dll
php_pgsql.dll

php-5.6.40-nts-Win32-VC11-x64
php_mysql.dll
php_mysqli.dll
php_pgsql.dll

php-5.0.0-Win32
php_mysql.dll
php_mysqli.dll
php_pgsql.dll
php_mssql.dll

@NathanGibbs3 NathanGibbs3 added the Windows Issues affecting installations running on MS Windows. label Nov 9, 2024
NathanGibbs3 added a commit that referenced this issue Nov 14, 2024
         Work on #216 & #231.
         Code Cleanup.

     File(s): admin/index.php
            : base_conf.php.dist
            : base_user.php
            : includes/base_constants.inc.php
            : includes/base_include.inc.php
            : includes/base_log_timing.inc.php
            : includes/base_output_html.inc.php
            : includes/base_template.php
            : includes/base_user.inc.php
            : index.php
            : languages/index.php
            : setup/base_conf_contents.php
              Code Cleanup.
     File(s): base_db_common.php
            : includes/base_log_error.inc.php
              Code Cleanup.
    Issue(s): #226
     File(s): base_maintenance.php
              Code Cleanup.
    Issue(s): #229
     File(s): base_stat_common.php
              Code Cleanup.
    Issue(s): #230
     File(s): includes/base_db.inc.php
              Code Cleanup.
    Issue(s): #231
              Additional logging to debug this.
     File(s): includes/base_krnl.php
              Bumped Kernel Version to 0.0.8.
              Code Cleanup.
     File(s): includes/base_rtl.php
              Bumped RTL Version to 0.0.13.
              Code Cleanup.
     File(s): phpcs.xml.dist
            : tests/phpunit.sh
            : tests/setuptestdb.php
            : tests/singletest.sh
            : tests/teardowntestdb.php
              Local & CI Test system adjustments.
     File(s): setup/setup_db.inc.php
    Issue(s): #228
     File(s): tests/setupdb.sh
    Issue(s): #216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working DB Database Issues DB-MsSQL Issues related to Ms SQL Server DB enhancement New feature or request invalid This doesn't seem right LCB-TechDebt Issue exists in Legacy Code Base. We inherited it. Prod Observed in Production Environment. Stability Issue impacts or is related to App Stability. Windows Issues affecting installations running on MS Windows.
Projects
None yet
Development

No branches or pull requests

2 participants