Apologies if this has been asked before. The two things in question are <4 characters so the search won’t find them.
I began by learning ASP simply because my place of work had an ASP enabled web server.
Some years later I got into learning PHP. But never got far at work because we have an MS SQL database and PHP is generally used with a MYSQL database. There are pages out there on the internet that show you how to connect to a MS db in php but I could never get their help to work so I just gave up and considered it not important.
But today I decided to have another go. it turns out you can connect to an MS db in a way that is almost identical to how you do it in asp - by using a connection string (rather than using a DSN, and rather than passing the server, id, and pw to a function) so I copied the exact conn string as is used on our asp stuff and I have been able to write some php which accesses the db.
So my question is this - Would it be a good idea to re-write all my asp stuff in PHP? Would it be better? Are there advantages to using PHP?
I will probably do some anyway just to learn PHP. I’ll keep the asp stuff live and write php stuff alongside it.
What say you all?
edit: Oh and a question specially for ZipperJJ - You taught me about putting your resultset into an array instead of directly using the result set to construct your html. The php code I borrowed off the internet does exctly that. So the question is this is it a) good practice and b) more efficient to do that?
If so I have a lot of pages that with just one small change I should be able to improve
This is good practice and more efficient, yes. Hit the DB and get out is most likely going to be your best route. We do 90% of our stuff this way.
As for learning PHP, yes do it. If you’re not going to learn .Net then you should keep at the PHP to be more marketable. It’s not going anywhere.
Whether or not to change your existing site into PHP…I say no. If the ASP is working fine, and your server is a Windows server, let it be. For us, at least, there always seems to be some extra step or glitch with getting PHP to run right on Windows.
ASP classic is on its way out (if not out already). But redoing an entire application in PHP would just be a waste of time. UNLESS…you are looking to really clean up your app completely, and you’re going to be fixing all the ASP anyway AND you are just as good at PHP as you are at ASP…then you might as well give it a shot.
As far as I know, the comparison between the 2 is pretty equal. People like PHP because it’s free and non-MS and works on any platform which are fine reasons for PHP. I’ve never heard anyone say it’s better performance-wise or functionality-wise than ASP.
Unless you’ve forgotten ASP, I’d say to just stick with it.
If I had to start all over again with some sort of huge website, I’d probably go with Java servlets, though. It’s the most strongly typed and least script-language like of the bunch (assuming you’re using VB.) the Java API also has classes for every conceivable use, so that’s essentially free code.
Performance-wise, I don’t know the answer. I think it’s one of those things where all of them are good enough that if you get enough pageviews that you need to speed the code up, you can afford to buy a more powerful server and avoid the issue.
I don’t have an answer, but here are some points to ponder…
ASP is a techological dead end. MS will continue to support it for gosh knows how much longer, but 100% of new work in the MS stack ought to be done in .NET.
That ought hides a multitude of side issues like compatibility with your current skill set, how much your needed functionality is growing as distinct from just your page volume, how well you can partituion your total software inventory into new & old, how much new dev is evolutionary versus greenfield, etc.
IANA expert on PHP, but if I was trying to future-proof (or even grow & maintain) a legacy ASP app and I had good reasons to not want to make the wrenching change to .Net, I’d sure look to PHP as the best alternative for keeping the same script-based style of app design while hitching my wagon to something that has a lot of years of life left in it. In other words, ASP & PHP have the same approach to problem solving and just differ (massively) in syntax. That puts your barrier to entry at a lower point: implementation vs design.
The one thing I would NOT do is plan to continue to create new ASP functionality indefinitely. Start doing real experiments in either .Net or PHP & see which flavor suits your needs & your limitations better. Then once you have both the skill & a decision, set a cut-off after which all truly new dev will be done in your new toolset, whichever that may be. Limit ASP to just adding tweaks to existing pages or fixing bugs.
There is no good answer to the problem of what to do with a large legacy app built on now-obsolete technology. Never has been, which is why some IBM 704 code is still running under emulation in the basement of some Fortune 500 companies.