Should I?

A

auntie_biotic

As you will see from my website. I am self taught and have just about
mastered the basics of html. I have even less knowledge of cgi but have
managed a message forum. I have just been told by my web hosting that PHP
and mysql are now provided.

My question is due to lack of time and funds which would I be better off
learning more about to further my site.
CGI, PHP or mysql. I am thinking of purchasing a "For Dummies or Learn in
24 Hours" book on one of the subjects from Amazon

PS: Is it true that PHP and CGI do the same things?

I apologise if posting in the wrong area.
Thanks in advance.

Website http://www.tbandu.co.uk
Message board http://www.tbandu.co.uk/cgi-bin/teemz/teemz.cgi
 
D

David Dorward

auntie_biotic said:
As you will see from my website.  I am self taught and have just about
mastered the basics of html.
http://validator.w3.org/check?verbose=1&uri=http://www.tbandu.co.uk/
http://www.allmyfaqs.com/faq.pl?Tableless_layouts
http://css-discuss.incutio.com/?page=UsingPoints

My question is due to lack of time and funds which would I be better off
learning more about to further my site.
CGI, PHP or mysql.

MySQL is a common database.

CGI is a way for a webserver to get a resource from the output of a program
instead of reading a static file. Often when people say "CGI" they really
mean "Perl accessed using CGI".

PHP is a programming language.

In the context of the web, you'll find MySQL pretty useless without PHP,
Perl CGI, or some other server side programming environment.
PS: Is it true that PHP and CGI do the same things?

No. PHP is a programming language that is usually (but not always) used on a
server to generate HTML documents on the fly. It can also be used outside
the context of a webserver for more general programming. PHP is usually
installed as a module for the webserver, but it can also be used through
CGI.
 
T

Toby Inkster

auntie_biotic said:
My question is due to lack of time and funds which would I be better off
learning more about to further my site.
CGI, PHP or mysql.

If you already know some CGI (by which I assume you mean Perl) then keep
going with that, and bring MySQL into the mix -- there is a rather good
Perl module to let Perl talk to MySQL.
PS: Is it true that PHP and CGI do the same things?

They are different ways of achieving much the same effect.
 
L

Luigi Donatello Asero

David Dorward said:
MySQL is a common database.

CGI is a way for a webserver to get a resource from the output of a program
instead of reading a static file. Often when people say "CGI" they really
mean "Perl accessed using CGI".

PHP is a programming language.

In the context of the web, you'll find MySQL pretty useless without PHP,
Perl CGI, or some other server side programming environment.


No. PHP is a programming language that is usually (but not always) used on a
server to generate HTML documents on the fly. It can also be used outside
the context of a webserver for more general programming. PHP is usually
installed as a module for the webserver, but it can also be used through
CGI.

What are the main disadvantages or advantages to use Perl instead of php to
send data to a database and viceversa?
 
D

David Dorward

auntie_biotic said:
As you will see from my website.  I am self taught and have just about
mastered the basics of html.
http://validator.w3.org/check?verbose=1&uri=http://www.tbandu.co.uk/
http://www.allmyfaqs.com/faq.pl?Tableless_layouts
http://css-discuss.incutio.com/?page=UsingPoints

My question is due to lack of time and funds which would I be better off
learning more about to further my site.
CGI, PHP or mysql.

MySQL is a common database.

CGI is a way for a webserver to get a resource from the output of a program
instead of reading a static file. Often when people say "CGI" they really
mean "Perl accessed using CGI".

PHP is a programming language.

In the context of the web, you'll find MySQL pretty useless without PHP,
Perl CGI, or some other server side programming environment.
PS: Is it true that PHP and CGI do the same things?

Not really. PHP is a programming language that is usually (but not always)
used on a server to generate HTML documents on the fly. It can also be used
outside the context of a webserver for more general programming. PHP is
usually installed as a module for the webserver, but it can also be used
through CGI.

So PHP can do the same job as CGI, but it doesn't have to. (Of course any
decent programming language can do the same things that PHP can do - but
CGI is explicitly there for communicating between the webserver and some
program)
 
M

Mitja

MySQL is a common database.
CGI is a way for a webserver to get a resource from the output of a
program
instead of reading a static file. Often when people say "CGI" they really
mean "Perl accessed using CGI".
Or sometimes more correctly (though still not completely correctly) "just
about any program accesed through CGI"

In the context of the web, you'll find MySQL pretty useless without PHP,
Perl CGI, or some other server side programming environment.
To the OP: this is because you have to acces the base somehow and convert
the "raw" results to a pretty-looking html page. So learn PHP first, later
on you'll use it to acces the MySQL database (using the SQL language, but
that one is quite simple).
Not really. PHP is a programming language that is usually (but not
always) used on a server to generate HTML documents on the fly. It can
also be used outside the context of a webserver for more general
programming. PHP is
usually installed as a module for the webserver, but it can also be used
through CGI.
Agreed.
OP: You needn't worry about how is the way php is installed on your server
called, just refer to host's instructions on how to actually use php
scripts (once the're written).
So PHP can do the same job as CGI, but it doesn't have to. (Of course any
decent programming language can do the same things that PHP can do - but
CGI is explicitly there for communicating between the webserver and some
program)
Now I find this a bit confusing. CGI stands for Common Gateway _Interface_
- it is a way of accessing programs, not a program or programming
language. It can't "do" anything.
See also http://www.google.com/search?q=cgi+definition
 
M

Mitja

What are the main disadvantages or advantages to use Perl instead of php
to send data to a database and viceversa?
There are none - both use the same underlying system, i.e. the same
database server. Use what you're more familiar with. If you're choosing
between perl and php, I recommend the latter - somewhat less powerful, but
easier and cleaner.
 
D

David Dorward

Luigi said:
What are the main disadvantages or advantages to use Perl instead of php
to send data to a database and viceversa?

Perl DBI (the standard way to access databases in Perl) is the easiest and
most elegant relational database abstraction layer I've encountered. (And
you have such things as Class::DBI to futher abstract it if you wish).

I've always found the internal PHP database handing routines to be a pain to
work with, especially once you start dealing with things such as magic
quotes (are they on or off?). There is probably something in PEAR to make
it nicer, but its been a few years since I had to write anything in PHP
that connected to a database so my experience is a bit out of date.
 
D

David Dorward

Mitja said:
There are none - both use the same underlying system, i.e. the same
database server. Use what you're more familiar with. If you're choosing
between perl and php, I recommend the latter - somewhat less powerful, but
easier and cleaner.

I'd say Perl was cleaner and, while harder to get started with, somewhat
easier to master.

Isn't opinion nice?
 
D

David Dorward

Now I find this a bit confusing.

CGI is a means by which a server gets dynamically generated data.

PHP can be a means by which a server gets dynamically generated data
(although it does the dynamic generation internally)
 
L

Luigi Donatello Asero

David Dorward said:
Perl DBI (the standard way to access databases in Perl) is the easiest and
most elegant relational database abstraction layer I've encountered. (And
you have such things as Class::DBI to futher abstract it if you wish).

I've always found the internal PHP database handing routines to be a pain to
work with, especially once you start dealing with things such as magic
quotes (are they on or off?). There is probably something in PEAR to make
it nicer, but its been a few years since I had to write anything in PHP
that connected to a database so my experience is a bit out of date.

Thank you for your answers.
It was nice to hear different points of view.
Actually, I have already read a bit about
Perl and PHP,
but I need learn much more.
Which sites and books would you advice for Perl and which for PHP?
 
D

David Dorward

Luigi said:
Which sites and books would you advice for Perl

Learning Perl: http://www.amazon.co.uk/exec/obidos/ASIN/0596001320/
http://learn.perl.org/
and which for PHP?

I haven't found a good book on PHP. The online manual isn't too bad
(although its ignorance about HTML is frightening: "The
arg_separator.output php.ini directive allows to customize the argument
seperator. For full XHTML conformance, specify & there." (Of course you
have to express & as & in HTML as well as XHTML - so why on earth is &
the default?! This is a pet hate of mine.)
 
L

Luigi Donatello Asero

David Dorward said:
Learning Perl: http://www.amazon.co.uk/exec/obidos/ASIN/0596001320/
http://learn.perl.org/


I haven't found a good book on PHP. The online manual isn't too bad
(although its ignorance about HTML is frightening: "The
arg_separator.output php.ini directive allows to customize the argument
seperator. For full XHTML conformance, specify & there." (Of course you
have to express & as & in HTML as well as XHTML - so why on earth is &
the default?! This is a pet hate of mine.)

Which online manual?



www.php.net ?
 
A

Art Sackett

David Dorward said:
CGI is a means by which a server gets dynamically generated data.

If I might, and without any desire or intent to step on any toes:

RFC3875 says:

1.1. Purpose

The Common Gateway Interface (CGI) [22] allows an HTTP [1], [4]
server and a CGI script to share responsibility for responding to
client requests. The client request comprises a Uniform Resource
Identifier (URI) [11], a request method and various ancillary
information about the request provided by the transport protocol.

The CGI defines the abstract parameters, known as meta-variables,
which describe a client's request. Together with a concrete
programmer interface this specifies a platform-independent interface
between the script and the HTTP server.

The server is responsible for managing connection, data transfer,
transport and network issues related to the client request, whereas
the CGI script handles the application issues, such as data access
and document processing.

If your definition of "dynamically generated" happens to include
"anything that's the output of a program", you'd be correct. OTOH, if
the act of opening and outputting the content of a static text file is
not within the scope of your definition of dynamically generated, then,
well... a bit less correct, perhaps.
 
A

Art Sackett

Mitja said:
If you're choosing
between perl and php, I recommend the latter - somewhat less powerful, but
easier and cleaner.

I'm with Mr. Dorward: Perl is cleaner. But I'll add the qualifier, "...
depending upon who wrote it." I've seen some terribly obfuscated perl,
but then again, I've seen some truly elegant, easy to read perl, too.

Ever since PERL5 brought us the ability to do OO, I've seen lots more
elegant, easy to read perl.

One of the great things about perl is that it allows (but doesn't
force) us to isolate code from markup. This way, the programmers can
focus on writing great code, the web designers can focus on creating
great web sites, and neither has to know the other's business. This is
how I've been writing my CGI (and mod_perl) apps for years, and it
works great. Sometimes it's a challenge to get the web designers' heads
wrapped around the concept of templates, but once the magical click
happens, it's a breeze. And it's nice on the web design front to be
able to totally change the look of the site without ever touching
software.

<plug mode="shameless">I'm available today if anyone's interested in
some custom CGI. A major client just postponed a project...</plug>
 
P

Phillip Parr

I used PHP and MySQL Web Development, 3rd Edition by welling and thomson
which was fantastic. It teaches you both from beginner to advanced, and
leaves you being able to do pretty much anything.

Phil
 
M

Mitja

I'd say Perl was cleaner [than PHP] and, while harder to get started
with, somewhat
easier to master.

Isn't opinion nice?

Sure it is :)
I must admit that I only got started with both PHP and Perl, just enough
for a quick fix or two in existent scripts. But I have seen quite more
than just one programmer's code in both languages, and still think php is
easier to read... Ah well. While we're at it, when it comes to readability
and general language ideology, I'm for Python anyway.
 
L

Luigi Donatello Asero

Mitja said:
I'd say Perl was cleaner [than PHP] and, while harder to get started
with, somewhat
easier to master.

Isn't opinion nice?

Sure it is :)
I must admit that I only got started with both PHP and Perl, just enough
for a quick fix or two in existent scripts. But I have seen quite more
than just one programmer's code in both languages, and still think php is
easier to read... Ah well. While we're at it, when it comes to readability
and general language ideology, I'm for Python anyway.


What about Java?
Java is used on the client side, isn´t it?
Is it not possible to send data to a data base by using Java?
And, as you mentioned Python, you may want to recommend a site and/or a
book about it.
 
D

David Dorward

Mitja said:
I must admit that I only got started with both PHP and Perl, just enough
for a quick fix or two in existent scripts. But I have seen quite more
than just one programmer's code in both languages

That's just coding style. You can write obfuscated code in PHP and Perl, and
you can write clean code in both too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top