What is the definition (app.php) for CAKEPHP to connect to MS SQLServer?

Asked 2 years ago, Updated 2 years ago, 115 views

Our development terminal has a track record of completing PHP 7.0 web applications without using a framework.This is a recognition that the connection was achieved by obtaining the necessary dll and adding the following to php.ini on the MSSQL2008R2 and Oracle11g database site.

extension=php_pdo_sqlsrv_7_ts_x64.dll
extension=php_sqlsrv_7_ts_x64.dll
extension=php_oci8_11g.dll

===Question ===
I have obtained a reference book for CakePHP3 to challenge development using the framework.Only SQLite and MySQL were defined for connection.I don't know how to define MSSQL (Oracle 11g) and connectivity because I don't have the ability to apply myself.
Could you tell me how to edit app.php to achieve connectivity with MSSQL (Oracle 11g)?
I hope it's not such a big barrier if it's a terminal that can achieve connectivity without a framework.

I just changed the following in app.php and checked the http://localhost:8765/ display. It seems that progress has been made in the DataBase connection status.This is a quick report.
'driver' = > 'Cake\Database\Driver\Sqlserver',
'encoding'=>PDO::SQLSRV_ENCODING_UTF8,

Enter a description of the image here

cakephp sql-server

2022-09-30 17:36

2 Answers

Self-resolved, i.e. connection to MSSQLServer has been achieved.
Oracle is not yet available...

Here is the site I used as a reference.
https://teratail.com/questions/39752

Specific instructions are added in the text, but the following changes have been made to the app.php.
'driver' = > 'Cake\Database\Driver\Sqlserver',
'encoding'=>PDO::SQLSRV_ENCODING_UTF8,


2022-09-30 17:36

Connecting to Oracle is not officially supported.

Deploy and connect the following plug-ins:

CakeDC /cakephp-oracle-driver: CakePHP3 Driver for Oracle Database https://github.com/CakeDC/cakephp-oracle-driver

The OCI 8 extension seems to have been added to PHP, so driver should be CakeDC\OracleDriver\Database\Driver\OracleOCI.

See the plug-in README for additional Datasource settings.


2022-09-30 17:36

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.