Koozali.org: home of the SME Server
Contribs.org Forums => Koozali SME Server 10.x Contribs => Topic started by: Bozely on April 20, 2021, 09:32:00 AM
-
Hi,
I used php odbc / FreeTDS quite a bit in sme 9 and now trying to configure SME 10 so I can upgrade. I pull a little information from a MSSQL database and need to get a connection. After installing php-odbc and unixODBC as well as FreeTDS I have had no luck.
Currently getting "Call to undefined function odbc_connect()". Could someone point me in the right direction on how to add extensions correctly using the SME10 php-fpm setup?
Thanks,
-
Managed to connect to the database via isql but php doesn't seem to see odbc
-
yum install php*-php-odbc
if still not working you might need a templates-custom to enabled it against non php5 version according google
-
yum install php*-php-odbc
if still not working you might need a templates-custom to enabled it against non php5 version according google
I have the same issue with SME 10.0, it appears that odbc is not loading. Added complication is that the command to restart Apache before 10.0 was /etc/init.d/httpd-e-smith restart. After each adjustment to php.ini to debug the issue, I have to reboot the server, very dull! Maybe this is a bug?
-
For clues look at the events in:
/etc/e-smith/events
Try
signal-event smeserver-php-update
Or possibly
signal-event webapps-update
-
Added complication is that the command to restart Apache before 10.0 was /etc/init.d/httpd-e-smith restart. After each adjustment to php.ini to debug the issue, I have to reboot the server, very dull! Maybe this is a bug?
# systemctl restart httpd-e-smith.service
-
The events *should* expand the templates, and restart the services.
Terrys command will just restart the web server.
Just depends what you require.
-
It's probably worth ensuring your ibay php version in the server manager matches the php-odbc version you're installing. This was my issue.
yum install php74-php-odbc
I was working off a clean install and didn't need to make any additional changes to get this working. Are you using this in conjuction with FreeTDS?
-
It's probably worth ensuring your ibay php version in the server manager matches the php-odbc version you're installing. This was my issue.
yum install php74-php-odbc
I was working off a clean install and didn't need to make any additional changes to get this working. Are you using this in conjuction with FreeTDS?
Thanks to all for chipping in.
Yes, FreeTDC to an MS SQL server.
The php74-php-odbc was probably the sticking point and I imagine that would have been covered in php*-php-odb suggested by Jean-Philippe earlier.
Having done the above, I've now progressed to Data source not found on odbc_connect.
On SME 9.2, the data source was specified in /etc/odbc.ini
For some reason that I've yet to discover, in 10.0 this doesn't appear to map over.
All the usual test using tsql etc works as expected. If I figure it before any one else shines a light on what I've overlooked, I'll post back here with the solution.
Terry. systemctl restart httpd-e-smith.service, I think was the answer I was after, allowing me to experiment with
odbc.ini. My procedures are behind on this one, as are the Wiki documents.
-
mate you and those who spend the time chasing things down rabbit holes do us all a favour :-)
-
Make sure you can succesfully ping the target machine by the computer name. I had to add an entry into my host file to get this working.
-
Terry. systemctl restart httpd-e-smith.service, I think was the answer I was after, allowing me to experiment with
odbc.ini. My procedures are behind on this one, as are the Wiki documents.
Hopefully helps others - https://wiki.koozali.org/Useful_Commands#Restart_httpd
and
https://wiki.koozali.org/Services#SME10
-
/etc/odbc.ini :
have you search the internet for the correct path in case you use php74 software collection ?
-
/etc/odbc.ini :
have you search the internet for the correct path in case you use php74 software collection ?
Well, it's been months finding time to get SME 10 on the road, and for what it's worth, I'll share my findings, regarding
odbc_connect and PHP 7.4 on this platform.
In SME9, PHP 5.4 I'd specified the dsn (first parameter of odbc_connect()) as "ProductDB" which in turn was specified in /ect/odbc.ini
Moving on to SME 10, this appears to no longer work, probably as a function of php7.4 (correct me any one if I'm wrong)
Postulating this to be the salient difference, the dsn must be now be passed in as an array, example
// $Source = "ProductDB";
$Source = "Driver=FreeTDS;Server=192.168.1.10;Port=1433;Database=SERVCO;TDS_Version=8.0;";
// Begin Here
$this->Connection = odbc_connect($Source,$Login, $Paswd, $this->Cursor) or die('Could not connect to the server!!');
if(!isset($this->Connection)) die("Database connection failed");
I can conform that [FreeTDS] elected in the dsn needs to be specified in /etc/odbcint.ini
Mean while, if any one can drive a coach and horses through my findings please do so.