Forum Moderators: open

Message Too Old, No Replies

ASP vs. PHP4

Can someone advise a newbie

         

markd

9:41 am on Feb 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello all

I am primarily a marketing and design person - so advance apologies for what may be a 'silly question' for you!

I work with an external programmer/database integrator, using ASP to control 'dynamically generated' pages or portions of otherwise static HTML pages.

I literally leave 'holes' in a table or HTML layout and indicate with a comment where the database driven content should appear. This is usually to allow clients to maintain certain sections of content within a page. My programmer, who is very good, will then do the rest!

He has suggested that we use PHP4 instead of ASP for future projects. He is an excellent Perl programmer, but I wondered if there are any advantages/disadvantages in using PHP4 over ASP?

As you can probably see from my description above, my projects are not massively complex, database driven sites - rather corporate sites where the requirement for a database solution is 'content management' rather than 'e-commerce'.

Any advice would be greatly appreciated!

circuitjump

3:50 pm on Feb 11, 2002 (gmt 0)

10+ Year Member



I would say PHP. Just because I like it a lot more then ASP.

But a good reason to go with PHP is first of all, it's free. It has a lot of prebuilt functions. I also like the syntax. It's more "programmer" like and there is tons of people out there trying to make it better.

Hope this helps

rpking

4:11 pm on Feb 11, 2002 (gmt 0)

10+ Year Member



I'd second that. I've moved from ASP to PHP and found only benefits. To name the ones I've used recently: dynamic includes, array sorts, built-in mailing, simple environment variable access...

If it sounds complex then it's not really, because all these are harder to achieve with ASP.

circuitjump

4:32 pm on Feb 11, 2002 (gmt 0)

10+ Year Member



The built-in mailing is a big plus in PHP. With ASP you can use CDonts, but thats if you're using IIS. It's also too simple, it does'nt give you much to work with. You can get more complex mail functions for ASP, but you gotta dish out the cash. Now what if you're using Chillisoft? I have'nt been able to find out if ASP has a mail function when running it on Linux-Apache servers thats free that is. Then again I don't mess much with ASP on a Linux- Apache Server

markd

8:36 am on Feb 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Excellent feedback, thank you all very much!

My programmer has also said that he 'likes' PHP a lot more than ASP.

The site in question will be hosted on Windows2000 servers with Perl libraries installed and will use a SQL database. I/we have used Perl scripting successfully with this hosting company who are extremely helpful.

Are there specific hosting issues when using PHP4?

circuitjump

6:41 pm on Feb 12, 2002 (gmt 0)

10+ Year Member



You know, I'm sure there are. But to tell you the truth I have'nt run into any. Or I might have and not know that it was PHP. But in all honesty, I can tell you that I haven't ran into trouble with PHP. Unless it's been my own fault( bad code or something along those lines).

Anyone else run into problems with PHP

Hope this helps.

jatar_k

7:15 pm on Feb 12, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I third the PHP recommendation. It is a great language. Like circuitjump, I use it for everything and haven't run into any problems except my own error or rewriting things that people wrote terribly the first time.

ggrot

8:17 pm on Feb 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Personally, I think they are both comparable languages and you shouldn't be choosing one over another based on overall feature sets. You need to consider exactly the job at hand and which tool would be better. If you don't know, you can hope that your programmer does. For the most part ASP is stronger in a windows development platform and PHP is better under unix. So if for some reason your project specs (or budget) dictates one of these OS's, then go with the respective language.

If you are choosing the OS based on the language choice, then I'd consider the databases and functionality. mySQL can't handle a large number of concurrent connections very well, as in hundreds of users requesting database access nearly simultaneously. While PHP can connect to Oracle, SQL server, postgres, access, or anything else, many of these are traditionally run on a Windows platform and having 2 machines(one the web server, the other a database server) may not be ideal. Also consider things like email functionality mentioned above as well as the need to interact with microsoft components or whatnot.

I've never used ASP, because most of the stuff I write is designed for a unix environment and budget is also an issue. But I don't always write in PHP either. Depending on the application, I may toggle sections of the system into pure compiled C++, which can perform much faster calculations but is a bear regarding ease of programming for the web. Its all about picking the right tool for the job. It sounds like your programmer has a few tools available to him/her which is very good.

EliteWeb

8:22 pm on Feb 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My prefs go towards PHP rather than ASP ;) but im biased.

cyril kearney

10:01 pm on Feb 12, 2002 (gmt 0)

10+ Year Member



A low traffic site may be successful with PHP but high-traffic sites probably need ASP (or the more advanced ASP.NET).

brotherhood of LAN

10:12 pm on Feb 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



ok a little off topic and a voice of inexperience...

1. I use office 2000 to get my site on the go, and uses ASP to connect to a database "dictionary of terms". I guess I dont really have to know anything about ASP for that. And eh, the server is Windows NT

2. Im learning C at college. I hope to continue learning it and become proficient in the language.

Whats the similarities between C and PHP/ASP? And what road should I go down when I become handy with C? Its a little vague n off topic but im sure an experienced user can cast their memory back to when they were as much in the dark as I :)

I hear about this ASP / PHP debate all the time. Seems like Unix is preferred over windows, and thus PHP is preferred over ASP

webworkz

10:48 pm on Feb 12, 2002 (gmt 0)



One thing you may run into with PHP:

Binary file attachments to multipart forms. PHP 4.0.* had a flaw which prepended the content-type to files, thus corrupting binary files.

Since 4.1.* is not yet stable (since I last checked), you may get stuck with 4.0.* and therefore run into this problem if you are dealing with and type of client file uploads.

I know this was a big deal on the *nix side of things, but I'm pretty sure it was not a problem with Micro$oft products, as a result of the Windows executable.

With PHP, you simply do not have the customization, simplicity, documentation, or support that comes along with becoming a PHP developer.

On the hosting.. you should rely on a Linux box. Anything Micro$oft is guaranteed to drop off the network sooner or later. I've done, and seen, enough NT administration to make me sick to my stomach.. and 2000 is no better.

Good luck.

Tapolyai

2:10 am on Feb 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check the top web sites what they run - sites that you trust and consider fast, cool, and in your alley. What are they running?

I actually ran Spinnaker (yes there was such a beast not so long ago), then move to ASP. Then I had to hire some programmers because I was unable to maintain some of the sites.

Three things I discovered - there are more PHP programmers, they are cheaper, and they know much more then ASP programmers. I run PHP exclusively now.

toolman

2:19 am on Feb 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>>A low traffic site may be successful with PHP but high-traffic sites probably need ASP

Can't say I follow the logic on that one. Every site that irritates me because it's slow is running on ASP or even worse than that is JSP.

cyril kearney

5:54 pm on Feb 13, 2002 (gmt 0)

10+ Year Member



I am a little confused by blaming slow response on ASP (and to a lessor extent on JSP).

ASP is essentially 6 objects that get invoked under IIS. If you read a database and the database takes 10 seconds to respond, then the poor response is caused by the database.

If the server can only handle 5 simultaneous users and everyone else waits then it is the server that is causing the poor response.

If your ISP is being overwhelmed with traffic, then the ISP is the bottleneck. I have a site that is serving 25000 to 30000 pages an hour during peak activity. This is because ASP is fast to server pages that fast when all the pieces are put together properly.

PHP means Personal Home Pages was developed for that market. ASP was developed for high volume sites. ASP.NET moves the performance notch up by using compiled code instead of interpeted code.

circuitjump

7:48 pm on Feb 13, 2002 (gmt 0)

10+ Year Member



PHP does not stand for Personal Home Pages anymore. It hasn't been called that in a while. The name is PHP: Hypertext Preprocessor.

[Added]That's also not what it's used for. It's used with all sorts of sites now. It's not just a developers special tool for his personal home page anymore.[/Added]

For more info on PHP, visit this page [ru.php.net...]

andrey_sea

8:40 pm on Feb 14, 2002 (gmt 0)

10+ Year Member



I was under impression that ASP is basically all interpreted code, while JSP is precompiled and therefore is faster...

cyril kearney

4:55 am on Feb 15, 2002 (gmt 0)

10+ Year Member



ASP is made up of compiled objects. Javascript, VBScript or Perlscript that is used in conjunction with ASP and interpeted.

Java by its very nature is interpeted and files the role of Javascript, VBScript and Perlscript. JSP, I expect is made up of compiled objects just as ASP.

The current version of ASP (ASP.NET) compiles Visual Basic, C#, J++(Microsoft's version of Java) and Perl and a dozen other languages too, including COBOL.

andrey_sea

4:24 pm on Feb 15, 2002 (gmt 0)

10+ Year Member



cyril,

I don't really follow when you say that Java is "by its nature interpreted." Before you can run a java servlet or a JSP page you must compile it, therefore it is not purely interpreted. When I say purely interpreted I am talking about things like VBscript and JavaScript...

So the difference between ASP and JSP pages is that you have to compile a JSP page and only then you can run it, ASP page runs without compiling and has to be interpreted every time user asks for it. Yes you can instantiate compiled COM objects in ASP, but the ASP page itself is still interpreted. With JSP you can you beans and servlets in a similar way to COM objects, but the JSP
page itself is compiled into a java servlet. You also can write a JSP page in JavaScript but it is a little convoluted (requires special add-ins) and it is simpler to write JSP in Java.

When you are talking ASP.NET you are talking a totally different animal than ASP.
ASP.NET has a lot more in common with JSP than it has with ASP. ASP.NET is compiled to run on an engine (common language runtime) similar to the one required to run JSP (Java virtual machine), With one big difference being that you have to run Microsoft engine on Microsoft platform of course ... :)

<added>
Don't get me wrong, I am not anti-Microsoft. I am actually very excited about writing a .NET based production system. If you believe Microsoft ASP.NET is supposed to beat the pants off the whole JSP/J2EE team...
[gotdotnet.com...]
</added>

wataru

3:29 pm on Feb 21, 2002 (gmt 0)



I found this very useful as a comparion between the two languages.

[php.weblogs.com...]

Since the programmer guy knows Perl, he'd probably be much happier with PHP. PHP was made from the best bits of all the main UNIX languages, including Perl and C.

Regarding the pet shop, there are too many holes in that to be called a proper benchmark, it's just another typical microsoft spin document. That's not to say I dont think Java is slower (I'm quite a pro Java person, however speed has never been one of its high points). But I really dont agree with that comparison as a benchmark, especially since Suns version wasnt meant as a benchmark peice of code, but rather designed to show the portability of the langauge.

[theregister.co.uk...] - "Pet vs Pet: MS opens .NET benchmarking wars"

Aaaanyway, arnt we comparing PHP to ASP not JSP.

I work as a server side programmer, doing mostly ASP, if I'm lucky we get some Perl through. The only time I've had to touch PHP is in my free time (ya see, my boss is something of a drone to the Microsoft wagon), and I have to say I love it (However Perl will always be my number 1 language). The language is so much more pleasing to write, the ASP syntax gets on my nerves it's so patronising. And if a programmer is happy writing a langauge, they will be more productive (which is why I'm writing this and not the ASP code I'm supposed to be doing, dont tell the boss :P ).

PHP is available for more platforms. It irritates me when people say "Windows is more available so lets just use ASP with IIS", they have just let Microsoft make the desision for them. Greater market share doesnt technically mean better, we all know Microsoft are sitting in the docks now facing the Anti-Trust law suit. I'm sure you are grown up enough to make desisions by yourself. Maybe even run some of your own benchmarks, who knows you may get some interesting results since you'll be testing on your hardware.

PHP has speed. Open Source is a great for many reasons, and in this case, you can compile the PHP environment yourself for your hardware so that it will take advantage of your processor instructions and cache better. ASP comes in 1 size fits all flavour only, sure they will have some optimisations, but you cant beat compiling it on your own hardware.
Now add to that compiling Apache, MySQL (or your choice of DB app) and your own compiled Linux (or any *NIX you like) Operating System and you have one heck of a fast web server.

Security exploits. Microsoft has problems with bad press we all know this, and they really hate it when someone finds a bug that can be exploited to take over a PC or DDoS (Code Red, nimda). These cant be helped, programmers are just humans, we make mistakes, let us forgive them. However, Microsoft are more and more beginning to keep exploits they find a secret (they even have a nice little group in which to keep their secrets, awwwww) and patching them up. Now at first, all is well and good, if they dont tell anyone there is a whole, then no one will exploit it right? Wrong... "Security through obscurity is no security at all" a well known phrase every one who has had to deal with locking up servers should know. All they do is leave those hapless people running IIS vulnarable until they can be bothered to patch it (maybe they delay the patch until the next service pack... hey who cares? no one knowns right?) or someone else finds out about it, then they can spring into action with a patch really early and look like the good guys.
Again, Open Source wins here, it encourages people to look through the code, bring exploits to the attention of the authors and the public. Now owners of the software will easily know they are vulnrable, and they can take intermediate steps to prevent it while they wait for the official patch (heck, they can patch it themselves, they have the source! but most people arnt up to this, I know I couldnt). With more and more eyes looking though the code for various reasons, there will be people spotting possible holes in the code, it may not have been what they were looking for, but with more eyes you can bring to light any potential problems faster. And with the exploits being made public, the programmers working on the project and others can learn from the mistakes made, thus improving the level of quality of the code and ending world hunger (okay the last bit is over the top, you get the idea).

[theregister.co.uk...] - "MS says stop discussing hack exploits"