Why PHP hosting is preferred over java hosting?

venu123

New Member
Messages
4
Reaction score
0
Points
0
When both PHP and Java hosting are free? why do we find more PHP hosting sites than java hostings??

Please help me out friends to figure it out
 

Jesse

Active Member
Messages
1,360
Reaction score
0
Points
36
PHP Hosting is common on the net. Although Java is also powerful it is rarely used. I think so... :p
 

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
isn't Java like a run-time applet or something? like don't you have to download the code onto your computer before you can fully use it functually..
(correct me if I am wrong)
if so then PHP is understood by the browser and not the computer...in easier sense....PHP can be used alot more and easier..
plus I don't know Java
 

deadimp

New Member
Messages
249
Reaction score
0
Points
0
If you're talking about Java applets, the host doesn't really play much of a part in this unless they explicitly block those file types. Java applets are executed client side, therefore don't have much of an impact on the server other than file transfer and maybe some extra transmitted info.
If you're talking about Java servlets, the host plays more of a part. Most hosts may not do Java servlets because of security reasons.
The reason PHP is so popular is because it's widely supported and maintained, and mainly an interpereted language, meaning you don't have to compile it - unlike Java.
 

jeyson65

New Member
Messages
10
Reaction score
0
Points
0
I primarily develop in Java so maybe my perspective would be helpful here. I'm assuming this thread is referring to Java servlet and JSP hosting. Applets are run by the client so the server has nothing to do with it. I would say the main reason that PHP is more popular is because it's simpler to host. Java being a compiled language does complicate things a little but typically Java applications are uploaded to a server as a single WAR file containing already multiple compiled servlets and JSPs. I don't think security is any more of a problem with Java than it is with PHP. I don't know where Java stands in popularity compared with PHP but Java is still pretty common. Java is also certainly well supported and maintained. Another problem with Java is that some changes require the server to be bounced. Most free Java hosts I've seen typically bounce the server on a daily basis for this reason.
 

venu123

New Member
Messages
4
Reaction score
0
Points
0
I guess it is because java consumes more resources and it is difficult to maintain...please correct me if I am wrong...
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I guess it is because java consumes more resources and it is difficult to maintain...please correct me if I am wrong...

Difficulty to maintain I'll correct you on; technically anything's difficult depending on who coded it. If you follow the usual standards I can't see Java being any more difficult to maintain by a skilled java programmer as it is to maintain PHP if you're a skilled php programmer.

Dunno about the resources part though; I've never really used Java, so I can't really say much about system resources.
 

coolv1994

Member
Messages
508
Reaction score
0
Points
16
php is one of the more commonely used langues and has the most functionally and scripts. also java is nice but not as easy
 

fdbessjr

New Member
Messages
24
Reaction score
0
Points
0
isn't Java like a run-time applet or something? like don't you have to download the code onto your computer before you can fully use it functually..
(correct me if I am wrong)
if so then PHP is understood by the browser and not the computer...in easier sense....PHP can be used alot more and easier..
plus I don't know Java
No, PHP is run on the server, and the output HTML is sent to the browser ;)
that's why it's so secure, because nobody can view you PHP script, all they can see if they look at the source is the HTML output, which won't tell them anything important

also if the browser had to run the script,
they would have to have the software to run the PHP ;)
 
Last edited:

tgkprog

Member
Messages
226
Reaction score
0
Points
16
both php and java-jsp output the same thing - html and run on the server.

java applets are client side programs also written in java - and u dont need a java server for them - this is a java applet http://sel2in.in/prjs/aplt/go my sites on x10 so no java on server (as yet)
 

xnguyenx

New Member
Messages
8
Reaction score
0
Points
0
its because php is more commonly used then jsp pages is...
there are tons of hosts that let you run jsp pages, just google :)
 

paul.sijpkes

New Member
Messages
5
Reaction score
0
Points
0
I have worked using both Java (JSP) and PHP over the last 9 years and I do find PHP easier to maintain. Mind you I gave up JSP about 4 years ago so, I don't know about now, but I remember JSP running quite slowly as well because it uses precompiled bytecode and runs on a virtual machine.

It was also tedious having to compile and build the WAR file and upload it, I find PHP much more accessible, all you need to do is edit the text file, upload it, and the interpreter does the rest. If you have a logical directory (folder) structure then PHP is very easy to maintain and update and runs very fast.

In regard to security, from what I understand both Java and PHP are only as secure as the machines they run on, if the machines aren't secured your scripts wont be secured either.
 

worldwise001

Member
Messages
57
Reaction score
1
Points
8
I've never done JSPs, however I have coded Java applications and applets. Java is client-side (unless they are JSPs), so how efficiently they run depends on your own system and your Java VM version.

I've only started programming recently with PHP, which is server-side. It is rather like perl, which means ease of use and tremendous flexibility, only more oriented for web purposes.

If any of you have worked with Java before, you know how wonky it can get especially with some of those really really rare exceptions you need to handle just in case the VM screws up. You also have to "compile" the code before you can use/distribute it, taking away valuable developer resource time which could have been used debugging, writing other code, etc.

PHP is also easier to maintain, and easier to configure in some aspects. Then again, I've never set up a JSP-capable server. Like paul.sijpkes noted, security is only as good as the machines they run on (and the people who maintain those machines). I'm no security expert, but I know about how potential flaws in coding that could result in a compromised system, especially when MySQL comes into play.
 

ihackdw

New Member
Messages
2
Reaction score
0
Points
0
I think its because php is run on the server not the client and java is run of off the client and is not fully compatable with all browsers.
Php out puts its data to html so the client cant see whats going happaning on the server, if you know what i mean.
 

leow0048

New Member
Messages
3
Reaction score
0
Points
0
its because php is more commonly used then jsp pages is...
there are tons of hosts that let you run jsp pages, just google :)

Are there really lots of hosts? Free ones? The only one that I could find is EatJ at www.eatj.com. But the free account (trial) is only kind of for testing, cos it'll just shut down by itself every 2 to 3 hours.

What other free jsp/servlet/ejb hosting are there? I found this directory http://www.oinko.net/freejsp/ but seems like most of the sites listed there don't exist anymore.

Anyway, as for the php vs java thing, I think php is a language which was designed for the web right from the start, so it's actually much easier to do web-programming with php. Java is more of a multi-purpose language like C, python, etc. So even though it can be very powerful, when it comes to web pages, it can be quite tedious to do some stuff.

A good example is the uploading of files. With php, you can save the file with basically one line:
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/somefilename");

But with java, it's far more complicated, so much so that there are libraries like FileUpload in Apache Commons (http://commons.apache.org/fileupload/).

I'm more familiar with java (both client and server-side) and I only hardly know any php (just picked up a bit), but I think php is definitely better for the majority of websites, provided that you don't have complicated business logic that require web-services, messaging, transaction-handling, etc. or other enterpise-level stuff (but well... that's debatable too).
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
(jsp) is not java...it is javascript....wow....
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
Let me explain the same thing once more:
PHP runs on the server and outputs a file to the browser.
JSP (which is a form of Java) runs on the server and outputs a file to the browser as well.
Java applets run on the client.

JavaScript has nothing to do with Java and runs on the client.
 

hopper

Member
Messages
225
Reaction score
0
Points
16
php code is easier to come by and more common
most forum software, cms software, gallery software is php
this forum for instance is php ;)
 
Last edited:

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
no...java applets are interpeted by the AppletViewer inside your browser and then defined by an HTML page using <param>'s
 
Top