I am currently reading two books, one on PHP and one on Python. Not that I'M good at ether. I'M about half way through the book on PHP or less and almost done with the one on Python. Though I haven't actually read anything web related in this particular Python book, I am aware that it can do web programming. My question is, which is better. Could I should I go ahead and drop the book on PHP considering that Python can do web programming as well as regular computer programming? Or does PHP have enough of an advantage to keep it up as well? Thanks.

Recommended Answers

All 10 Replies

I think both would work really well, but you'll have an easier time getting support if you're using PHP because that is a very common setup. PHP makes it really easy to grab the form fields and it might not be that easy in python. There are tons of directions on how to make Apache or IIS run PHP apps, but you'll have a more difficult time finding instructions on doing it with python.

Just my thoughts. It's probably not as difficult as I make it sound.

I haven't worked with Python, but I work with PHP and JSF. If your focus is just on web programming I'd recommend PHP. But you should always keep in mind to choose the correct language for your solution.

PHP is a good choice because it's specifically made for the Web and as such has massive support and is easy to setup with other web related technologies. It also has a pretty large collection of libraries that you can just drop into the ext folder and use.

Don't stick to just one, use the best tool. Being loyal to one language is nice, but it won't get the job done.

You can have a look at this to have an idea of web programming in python
http://webpython.codepoint.net/
and this
http://webpy.org/
I've never done web programming in python because norm in my job is php so i had to learn php. And i find it much less pleasant to write.
If I had choice, i'd certainly give a chance to python because it's very pleasant and fast to write.

I am working with python on web applications from 2002. For the most I use Zope and Plone on it (a CMS). It is not a common choose because the object database backend, but there are al lot of python framework using the standard way of a relational DB: Pylons, TurboGears and Django (the most notables). All these frameworks can easily integrated wich Apache or other web server, but you need a hosting that provide python or a complete server.

Python is easy to write, but I find setting it up for even local development is a headache! If it is such a headache to Just setup it, how can I practice?? For this one, I suggest PHP. PHP isn't difficult either though it is C++ish

Python is easy to write, but I find setting it up for even local development is a headache! ...

Under linux you have Python by default. If you need to experiment with libraries and don't want to mess the system, Python has virtualenv, installable as package. If you want to try the last version compiling Python from sources takes 10-20 minutes... maybe under Windows is another story, I don't know.

Under linux you have Python by default. If you need to experiment with libraries and don't want to mess the system, Python has virtualenv, installable as package. If you want to try the last version compiling Python from sources takes 10-20 minutes... maybe under Windows is another story, I don't know.

I meant to set it up for Web applications. I use windows.
I have Installation and works fine for desktop apps :)

I meant to set it up for Web applications. I use windows.
I have Installation and works fine for desktop apps :)

Usually the python frameworks have its web server so under Linux we install the available package for Apache and use it only as a proxy and only on production machines. mod_python and mod_wsgi are used from few people.

Usually the python frameworks have its web server so under Linux we install the available package for Apache and use it only as a proxy and only on production machines. mod_python and mod_wsgi are used from few people.

I tried to set up mod_python to work with WAMP so as to use PHP/Python side by side, and guess what? I ended giving up. The process is so convoluted that It was only headache to me. Not so fun!

Python is an excellent choice for web programming (as it is for any other type of programming). There are myriads of web frameworks to choose from, some of which are really good.

But Python is not mainstream. PHP is. A random choice of project or company is likely to dictate PHP. Also, there are many mainstream apps (blogs, wikis) that are already built in PHP. More than there are in Python. If you have to work on top of those, you'll have to take PHP.

But while being mainstream is less risky in a way (there are much more mainstream jobs than "exotic" jobs - though "exotic" jobs may be more lucrative than mainstream jobs), it also makes you dispensable (there are much more mainstream developers than "exotic" developers).

It depends on your personality type which way is the best for you. If "mainstream" feels better to you, focus on PHP first. Otherwise, focus on Python first.

But even if you choose PHP for your daily job focus, I'd strongly recommend learning Python anyway. There is SOOOO much you can learn from Python about good programming idioms and patterns. Learning Python will improve ALL your programming skills, not only your Python programming skills.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.