EasyApache 4 PDO_DBLIB (mssql support)
Completed
I need to be able to connect to a ms sql server database from php. The native mssql driver has been deprecated and removed in php 7.0. The only way to connect to mssql moving forward is PDO_DBLIB or PDO_ODBC. PDO_DBLIB is preferred.
This is a major issue for me. I run cpanel servers and I cannot move to EA4 until there is a way to connect to MSSQL from PHP supported. The only prerquisite for PDO_DBLIB is FreeTDS so I do not know why this is not supported yet. I cant imagine it would be too difficult to build a PDO_DBLIB package.
Hey all! It looks like I got my wires cross, and PDO has been available for some time. You can see them in the EA4 repo here:
If you need these, feel free to install!
Hey all! It looks like I got my wires cross, and PDO has been available for some time. You can see them in the EA4 repo here:
If you need these, feel free to install!
Honestly, I posted this before I realized EA4 already supports PDO_ODBC which does support MSSQL connections... So i guess this is not needed. At least for me.
Honestly, I posted this before I realized EA4 already supports PDO_ODBC which does support MSSQL connections... So i guess this is not needed. At least for me.
How did you get it working? We're having trouble getting it to recognize the defined drivers.
How did you get it working? We're having trouble getting it to recognize the defined drivers.
I have done this with ODBC and EasyApache 4. First install the PHP PDO_ODBC module in EA4
Then we have to install Microsoft SQL Server ODBC Driver for Linux, download available at https://www.microsoft.com/en-us/download/details.aspx?id=28160
After following the instructions to install it and restart Apache I had to edit the file /etc/odbc.ini with this config:
Driver = SQL Server Native Client 11.0
Description = Database access
Trace = No
Server = 123.456.789.0
Port = 1433
Database = DatabaseName
Then on the PHP script connect to the database like this:
putenv('ODBCSYSINI=/etc/');
putenv('ODBCINI=/etc/odbc.ini');
try {
$db = new PDO("odbc:MSSQLServer", $username, $password);
} catch (PDOException $exception) {
echo $exception->getMessage();
exit;
}
$q = $db->query("SELECT * from Table");
while ( $d = $q->fetchObject() ) {
var_export( $d );
}
This way I managed to make the connection to the MSSQL Server.
I have done this with ODBC and EasyApache 4. First install the PHP PDO_ODBC module in EA4
Then we have to install Microsoft SQL Server ODBC Driver for Linux, download available at https://www.microsoft.com/en-us/download/details.aspx?id=28160
After following the instructions to install it and restart Apache I had to edit the file /etc/odbc.ini with this config:
Driver = SQL Server Native Client 11.0
Description = Database access
Trace = No
Server = 123.456.789.0
Port = 1433
Database = DatabaseName
Then on the PHP script connect to the database like this:
putenv('ODBCSYSINI=/etc/');
putenv('ODBCINI=/etc/odbc.ini');
try {
$db = new PDO("odbc:MSSQLServer", $username, $password);
} catch (PDOException $exception) {
echo $exception->getMessage();
exit;
}
$q = $db->query("SELECT * from Table");
while ( $d = $q->fetchObject() ) {
var_export( $d );
}
This way I managed to make the connection to the MSSQL Server.
Howdy,
I've built out FreeTDS for EasyApache 4, and I've enabled MSSQL support in PHP5. Since PHP7 doesn't support MSSQL, you'd have to use PDO or the like for that.
As this hasn't been through the full team processes and releases yet, I've only built them out on build.opensuse.org, here:
https://build.opensuse.org/project/show/home:Jperkster:ea-freetds
If you would, please check out the RPMs and test them out, see how they work. Feedback here is most appreciated so that we can get everything done quickly to get it into the mainline EA4.
Thanks for your patience!
Howdy,
I've built out FreeTDS for EasyApache 4, and I've enabled MSSQL support in PHP5. Since PHP7 doesn't support MSSQL, you'd have to use PDO or the like for that.
As this hasn't been through the full team processes and releases yet, I've only built them out on build.opensuse.org, here:
https://build.opensuse.org/project/show/home:Jperkster:ea-freetds
If you would, please check out the RPMs and test them out, see how they work. Feedback here is most appreciated so that we can get everything done quickly to get it into the mainline EA4.
Thanks for your patience!
We'll be pushing an update to the production EasyApache 4 repo that includes this RPM on April 18th. We'll be back to update again when that goes live!
We'll be pushing an update to the production EasyApache 4 repo that includes this RPM on April 18th. We'll be back to update again when that goes live!
Hey all! It looks like I got my wires cross, and PDO has been available for some time. You can see them in the EA4 repo here:
If you need these, feel free to install!
Hey all! It looks like I got my wires cross, and PDO has been available for some time. You can see them in the EA4 repo here:
If you need these, feel free to install!
Replies have been locked on this page!