Can Microsoft's SQLSRV driver for PHP run on Apache? - php

Scenario:
I have a PHP website running on Apache server
I have an ERP system (MS SQL) that runs on a different server
I need to connect from my website to that MS SQL server
I need to work with Microsoft SQL Server in my PHP application. I've managed to get their SQLSRV driver for PHP running on my localhost (WAMP, Apache + PHP 7.2).
I will need to deploy the app to a live website in the future that also runs on Apache server. Will this work? I can see Windows / Windows Server operating systems on their requirements page, but I am not sure whether they mean on the client side (the app that loads the driver) or the server side (where database is stored). On WAMP it works, but I am not sure whether it is because the WAMP itself is running on Windows (even though the server runs on Apache) or not.

Firstly, you're asking the wrong question. Apache is the web server which you're already using, so you know that the answer to "can it run with Apache?" is "yes".
The relevant compatibility is with the operating system - you're running it on Windows, and you need to know if it will run on a different OS, probably some flavour of Linux.
Secondly, the documentation you've found looks to be very out of date. Microsoft has up to date documentation on their own site including a much larger list of supported operating systems. As well as Windows, it lists the versions of several Linux distributions that are officially supported, and several versions of macOS.
It's impossible to say for certain, or give any details of what packages you'll need to install, because you don't actually tell us what system your production server is; but the answer is almost certainly yes, a compatible version of the sqlsrv driver will be available.

Related

How to set up a server to run an application which is based on PHP language

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.

Multiple versions of Apache installed and conflicting

I started trying to create a website which uses PHP on an old computer (previously used by another programmer).
I wanted to test my PHP code without uploading it each time, so I downloaded Apache and installed it. I was starting to set Apache up when I discovered this computer already had Apache on it.
Now I had multiple versions of Apache, so I went into add/remove programs and got rid of Apache (which only showed up once in the list).
Unfortunately windows decided it would uninstall the old version and keep mine which was not functioning properly. Also for whatever reason it seemed to have kept a good few files from the old version, but not enough that I could actually use it in any way. I believe it just had some configurations files.
I thought I would copy my files from the new version into the old version and not replace anything so hopefully I would be able to run under the older configurations, but that didn't work.
At this point I just wanted to cut my losses, so I put all the versions of Apache in an archive so there was no way the computer could be using them. I also removed Apache from the windows startup and rebooted the computer after configuring one single version of the newer copy of Apache to supposedly run PHP.
The problem is upon startup I could immediately log in to localhost and apache was already running. Also when I opened Apache manually from the files I had left unzipped, it only gives me the option to start Apache (not an option to stop or restart implying it is not running) and when I click it, it says "The requested operation has failed!" which is less than helpful.
So anyway, I just want to be able to run PHP locally and now I don't feel like I can even successfully uninstall and start from scratch anymore. Does anyone know what I have to do to get this to work? Sorry for the long description, I wove such a tangled knot.
One way to solve is use a XAMP (Apache + MySQL + PHP) client like XAMPP http://www.apachefriends.org/en/xampp.html brings it all set up for you to use. The problem of conflict can be caused by any IDE (Netbeans for example) that already carries a version of Apache.
Try to configure config files of Apache case exist.
Assumption: Running Windows OS for development and linux for production environment.
My recommendation is to not mix the Windows and Linux worlds as while they can be made to behave after lots of work, it is usually more pain than good.
Instead, as a humble windows and linux user, download and install Virtualbox [https://www.virtualbox.org/wiki/Downloads], a free open source virtualisation tool.
Then download a linux distribution of your choice and install that into a new virtual machine.
Configure the linux tools inside linux and leave your windows machine relatively untouched.
A useful linux service to install would be Samba - windows file sharing - you can use this to edit your code in windows using any IDE of your choice, while saving directly to linux and testing through linux. When happy, upload from the linux system (again like any other file uploader) and all will be well.
If you are deploying to a linux based environment in your production service then this will help you avoid common mistakes such as case-sensitivity trouble and many others.
Building and running this system is free and it will help teach you more about the linux environment you are deploying to also.
Equally, when you don't have the virtual machine booted, there's no services lying around exposing your computer to possible local network threats and consuming resources - as opposed to installing Apache on Windows where it will be using some resources all the time.

SQL Server 2005 php 5.2

I'm having a really difficult time trying to get php to connect to SQL Server 2005. It seems like no matter what I do or what page I visit, I either get the wrong extension/driver or find a dead link. The most recent attempt was php_sqlsrv_52_ts_vc6.dll which apparently doesn't support anything prior to 2008.
After over two days of searching, I'm lost, and upgrading either php or SQL Server is not an option unfortunately...
EDIT:
Everything is running on IIS 6 - Server 2003 (Same box).
Your problem probably is that you are running IIS6, which will require the nts-version.
Additionally you have to install the SQL Server Native Client 2008, which is a bit misleading as it will still work with MSSQL 2005.
It should go something like this:
Download SQL Server Driver 2.0 for PHP
Place the dll (5.2 nts) into PHP's ext-folder
Enable the extension in the php.ini extension=sqlsrv*.dll
Install a recent version of Microsoft's Native Client (e.g. from the SQL Server 2012 Feature Pack)
Restart your web server.
I use Apache, so I'm not sure if there is anything else to do on IIS or whether some of the steps differ, but this is how I got it working.

Looking for a web server that include the following technologies ColdFusion, PHP, MS SQL Server, MySQL

Can anyone explain if it is possible to have a web server for all of these technologies:
ColdFusion, PHP, MS SQL Server, MySQL
I have a web developer insisting that they require all of the above however it doesn't quite make sense to me.
Any help or clarification is appreciated.
It's possible, but MS SQL being a Windows only product, you'll need a Windows server, preferably one from the Server family (Windows Server 2003 or 2008). PHP and mySQL can run happily on Windows, I've got them both running on the Windows 7 machine I'm writing this on.
I don't know whether a hosting provider will run all these things on the same server in a standard (cheap) package - you may have to have one tailor-made. But that depends entirely on your situation, of course.
As to whether this makes sense, though - I don't know. Is this a new product being developed? Then it sounds very strange to need two different database platforms, and two entirely different web development environments. If it's to integrate a number of existing products, it may make sense.
It is possible to have all of those technologies installed on a Windows server
It is possible to make a connection to both MS SQL and MySQL via both PHP and ColdFusion.
Providers usually have PHP and MySQL as combination, but the bigger providers have also windows based hosting with an MS SQL database server, so a connection from the PHP linux server can be made to a MS SQL server (you do need some special library installed though I read).
Not many providers offer ColdFusion hosting, at least not in a shared manner. There are a few, godaddy to say one among others such as hosting.com, take a google around the world to find them.
If you want to do this yourself, you could get a Windows VPS and install all the required software.
ColdFusion exists now also opensource, something not many seem to know: Railo
It is possible to have all of those installed. We have a LAMP server that runs all of that but MSSQL. You could have a Windows box run all of them too. Not sure about MSSQL on Linux, but I know its definitely possible to have all that on a Windows box.

recommended production environment for php5 application on windows?

We are about to deploy a php5 / symfony / mysql application on a windows stack (windows 2003 server)
Our IT department doesn't have much experience administering any other stuff but microsoft technology, so I'd like to know what configuration would you propose for a production environment...
apache and php on windows?
php on iis?
etc...
the application should use integrated security (that means the have should have some way to find get the domain/username of the logged user, in classic asp is as easy as Request.ServerVariables(“AUTH_USER”) )
it would also be very useful if you could point me to documentation on the subject.
This question and especiually the links in it may answer parts of your question: Apache vs. IIS PHP performance comparison
PHP works fine with IIS, although I've only been able to configure it to run with the site in the IIS directory hierarchy. (c:\inetpub\wwwroot). I've never been able to get it to run with a virtual directory outside that hierarchy.
Also, assuming that IIS is running (it is by default in Server 2003), IIS and Apache can't share port 80. If you have both running on the same box, one or the other will get port 80, but not both.

Categories