I’m actually developing a CI app in my developer machine with Windows and XAMPP, using de sqlsrv driver to connect to the MS SQL Server 2008 database.
But the final server machine is an Ubuntu server, and trying to run the app from there doesn’t work because of the sqlsrv driver not installed in the server.
I tried the mssql driver and the app starts to load but it ends with SQL queries errors (SQL queries previously tested and working).
What do you recommend?
Is it possible to connect from Linux/PHP/CI to SQL Server 2008? If there is a way, will it be as fast as running on Windows? It will be compatible with CI Active Record?
Is it better to create a new Windows server?
Thx
I would say that you should develop on whatever you deploy to so if you will stick to dev on windows, deploy to a windows box.
If you do want to get it working, I have seen a ruby app talk to ms sql 2005 before, you need to make sure you have FreeTds working, this looks like a good walkthrough:
http://php.net/manual/en/mssql.setup.php
If you are using sql 2008 there are some features which probably are not in sql 2008 like table valued parameters which FreeTds won't support so it might be not working because you are trying to use something it can't do - have a look at the query that fails and see what types it has and the types of the responses, if anything is new to sql 2008 it might not work.
Related
We have real old server running DTS packages and SSMS 2008 or older. We need to transfer our DB to new server that can also run PHP applications.
What do I need to do to set it up?
Thank you,
If you are using an old Win server that is vulnerable to hacking and wish to replace it with a new one (capable of running PHP), broadly you have two choices:
Windows Server
a) You may stick to using Win server OS and upgrade the db version and server OS to the latest version (SQL Server 2022 and Win Server: 2022) , then if you wish to run PHP on the machine, you may install it thru Microsoft Web Platform Installer so that the machine will be one with IIS capable of running PHP. For details, please refer to MS site:
https://learn.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php
Linux Server
b) you may choose to set up a linux server which is capable of running PHP/MySQL, and migrate the existing MSSQL database (as you have specifically mentioned) to MySQL thru some sort of migration tools
For setting up a linux server capable of running PHP (aka LAMP), you may refer to the following link (and others)
https://superuser.com/questions/993316/how-do-i-set-up-a-lamp-server-from-scratch-using-centos-6-7
For migrating the MSSQL to MySQL, you may refer to this SO post for some reference / information:
How to migrate SQL Server database to MySQL?
I prefer Ubuntu for a long time, so I would install the latest Ubuntu version on a server.
I would use apt install to install mysql and php8.
Dump the old database to file and copy it to new server.
Import the new database.
Please bear with me.. I am not entirely sure how to ask this question. I hope someone catches on.
I do my PHP (7.4 and 8.0) programming in FreeBSD, connecting to Windows based SQL servers using PDO_ODBC. In FreeBSD, I successfully use FreeTDS to pull data over ODBC and everything works.
What I am developing is meant to run on XAMPP or WAMP (or any similar stack) on a Windows Server of recent flavor, but when I copy the PHP code over, my query fails. I have set up a 64bit DSN which successfully connects to the target database and I can run queries against the database - at least in simple terms. The code I am trying to migrate contains a fairly complex query and running it on this platform return 0 data to the PDO. It runs fine in SQL Management Studio.
So the question is very open ended, but for now: Why or what?
I'm sorry if this question ever asked before. However, I'm getting frustrate about this stuff.
Currently I'm maintenance a project, I'm using WampServer 2.0, PHP 5.2.5 and SQL Server 2005.
I've added extension=php_sqlsrv_52_ts_vc6.dll inside php.ini copy the file to php's extension. However sqlsrv_connect() in the project didn't work. I read the manual book of the project, I have to install SQL Server 2008 R2 Client Native since this project was developed by other programmer few times ago using wampserver 2.0 and SQL Server 2008. In other word, the prerequisites: - Install Driver SQLSRV20, SQL Server 2008 R2 Native Client. But, I still confuse what's SQL Server 2008 R2 Native Client used for. Do I need to install it though I use SQL Server 2005?
Please help.
Thank in advanced
Yes you do. Explained more fully here.
I'm interested in quering a Pervasive DB server running on a Windows platform from Linux.
Would anyone happen to know if this is possible, what's required and what resources there are for me to read up on it?
Thanks!
What version of Pervasive are you using? All versions since v8 (including v9 and v10) support a Linux client which is included with the Pervasive.SQL server engine. V9 and V10 clients are also available for download from the Pervasive website (http://www.pervasivedb.com/Database/Products/PSQLv10/Pages/PSQLOverview.aspx). Once you've got a client installed on the Linux machine, you can create an ODBC DSN or use the Btrieve API to access the data.
Most database have at least a command line client to connect to database. check your brand of database to see if you have such tools. For example, Mysql has mysql command line client for making query to MySql database. Otherwise, another way is you might want to try setting up ODBC with Perl.
I've inherited some code that uses the sqlsrv_connect method to instantiate a connection to a SQL Server database. My personal development machine is an OS X box that I'm running apache an PHP on. I have an instance of SQL Server running in a virtual machine.
When I attempt to connect to the database, I get the following error.
Fatal error: Call to undefined function sqlsrv_connect() in ...
It appears that sqlsrv_connect is not part of standard PHP, and is part of a driver that ships with SQL Server 2005. (please correct me if I'm wrong here)
Is there a way to use this function on Non-Windows platforms? I realize I could install/build an Apache/PHP instance on my Windows machine, but if there's a way to get this function working on OS X (or other *nixes) I'd prefer it.
Is not possible. The SQL Native Driver for PHP is Windows only product:
The SQL Server Driver for PHP relies
on the Microsoft SQL Server 2005 ODBC
Driver to handle the low-level
communication with SQL Server. As a
result, the SQL Server Driver for PHP
is only supported on Windows.
You can look here for a tutorial on how to install the extension. (Via Google)
I'm not too famillar with the extension, but that source should be able to help you out.
(Updated Link to Better Source, still via Google)
The SQL Server Driver for PHP (from MS) is available only on Windows. Unless you want some specific features offered by this driver/ API, you can use the PHP ODBC module along with UnixODBC/ iODBC driver, or FreeTDS (ODBC or db-lib)