Starting out doing server side things - what languages and techniques to choose? - php

I've been doing html, css and javascript for quite a long time, mostly for my very own enjoyment. I would say I know fairly much, I've created many simple games and apps and experiments with javascript. However there is only so much that is possible to do in the browser, for any more "complete" websites I am constantly confronted with my ignorance on server side programming.
So, what do I need. I need to get my head around how to use databases and how to use some server side programming language, I guess. What is the right choice? What should I avoid?
Thanks.

PHP and MySQL have a pretty low barrier to entry (they're both free and ubiquitous). I'd start with those, since most hosts provide them for you. As an added bonus, they work really well together (and PHP isn't very hard to learn coming from a web development background).
Head First SQL is a great book for learning MySQL. All of the examples in the book are done on MySQL. The book even explains where to get it and how to install it. As for PHP, the introductory tutorial at official website is the best place to learn it.
Update: Head First PHP & MySQL is now available. I haven't read this one yet, but other books in the series and by the same author are great for learning new languages from scratch.

Download Python. Learn the Python language. Learn Object-Oriented programming.
Python includes SQLite, this makes it easier to Learn the SQL language.
Download the Django framework. This makes it easy to write server-side applications that work simply and reliably.

I would suggest PHP. Not because it's the best, most modern or cleanest language out there, but because it is easy to learn for someone coming from pure HTML.
You begin by just adding tiny bits of PHP to your regular HTML and magic happens :)

Ruby is a fantastic language and the frameworks for web stuff generally teach you some good practices. Try it. The Learn to program book uses Ruby, maybe you'd like to check it out.

I noticed in your question you mention that you've been using javascript. If you're comfortable progamming javascript, I've recently begun working with server side javascript in the form of EJScript on linux and using jscript on windows. It's been fairly painless, and the documentation has been pretty good so far on both.
If you're more interested in learning this with another technology then Django & Python or ASP.NET & C# (or IronPython) are both fairly low barrier to entry platforms available on windows, *nix, etc...

I would say that if you're comfortable working in Linux, then go for PHP and MySQL. If you aren't comfortable working in Linux, then download the free Visual Web Developer version of Visual Studio Express, and get started using that. This lets you program in VB.Net or C#, and use the .Net web development framework. It's really miles ahead of anything PHP in terms of how nice a platform it is to work on. There's also a free developer edition of SQL Server that lets you store up to 4 GB of data.
There's plenty of .Net hosts out there now too. Although, due to increased license costs, Windows hosting plans will usually cost more and give you less space/bandwidth than Linux hosting plans, you can still get enough room to play around with and deploy some apps on the web. If you develop something really cool, and outgrow what your hosting account provides, it's probably time to upgrade to a VPS, and post ads on your site to start paying the bills

I'd recommend PHP for folks who are familiar with HTML but are newish to programming. Here's why:
I'm currently an ASP.Net developer, and I think that ASP.Net abstracts waaaaay to much to make it a good first programming environment. I say learn how to generate and manipulate straight HTML with a language like PHP instead of trying to understand GridViews, etc., which have no bearing or relevance to programming in the broader sense.
I wouldn't say ASP.Net is "the Dark Path" or anything, but if you start out by learning it, you'll tend to favor the warm and insulating arms of the framework. ASP.Net is pretty much a code-generator when compared to more explicit (some would say reckless, messy, and tedious, but I'm not one of them) methods like PHP.
With PHP you'll see the effect your code has on the actual HTML when you view source. With an ASP.Net page, you'll be baffled by the amount and complexity of the HTML it spits out.
After you get your hands dirty in PHP, you can explore the pros and cons of frameworks like ASP.Net that "do a lot of the work for you".

I was exactly in your situation 3 to 4 years ago and, like some of the commentators suggest, I tried PHP because of its low barrier of entry.
That was a mistake! Oh sure I was able to achieve some things here and there, including using a contact form from a book which was so flawed that it was later hijacked by big time spammers and got my domain banned from most email servers out there.
Later on I tried to learn how to create dotabase driven sites with object oriented programming following the guidance of the excellent books, blog posts, and forums from Sitepoint and other sources. It was just too hard for my little brain. I just could not do it.
So what happened? 2 1/2 years ago I decided to learn Rails, which had just turned v. 1.1. It has been fun since the beginning and extremely rewarding. Working with Ruby is a pleasure, much easier to learn than PHP, and the Rails framework is so well put together that you can, with little effort, produce some very elaborate web sites with advanced features all while learning how to do proper object oriented web programming.
I used my new knowledge to recreate from scratch the site of my non-profit organization (with a new domain ;-) and, with a friend who is a talented designer, created a web development firm.
Don't get me wrong, it's not that easy, if you want to learn programming you need to put a lot of effort into it but in my own experience Rails can bring you some instant results while letting you get deeper and deeper over time.
I recommend two main sources of knowledge:
The excellent, official Rails
guides.
The free screencasts
from Railscasts.
Whatever your choice will be I wish you the best and a fun and fulfilling experience

I recently came upon this question myself. I really liked the way PHP integrates with HTML making designing a site more natural in my opinion. Design your site as you would with static content and then switch the static with the dynamic. However, I wanted to choose a "good" language. I looked at PHP, Ruby, Perl, and Python, as they are the most popular, open source options. I didn't need any powerhorses, if you will, like Ruby on Rails or Django, since I just wanted to mess around with server side stuff and some SQL—nothing serious. I don't remember why nor do I care to remember why, but I chose Python. But I still wanted that integration with HTML. I came across Karrigell. It's a neat piece of Python that essentially handles the integration. It comes with a little web server which you can use on its own or use something like mod_proxy with lighttpd. The devs don't limit you to only Python inside HTML, though. Their server parses: Python inside HTML, HTML inside Python, plain ol' Python scripts, and Karrigell services. It may not integrate as well as PHP does, but it's pretty damn good.

Related

Is Haxe really good for php-targetting server side development?

I have such a conception, to build a simple web application using some php/mysql hosting service. I'd also like to create a local version of that app. The local version should work similarly as the online one (i.d. using browser as the ui) and have the ability to communicate with the server. I want it to be as lightweight as possible.
Professionally, I'm a c#/.net programmer. I also have some experience with c/c++,javascript, python and java. I know very little about php, and honestly, I don't like the feeling coding in that language, hence, don't have much willingness to dig into it. .Net, python or java they're all too unwieldy, I can't force the users to install any of them. So I thought about haxe's multi-targeting. If I were to code the project in haxe (it seems pretty straight forward to learn, for some one with my background), I might use the same logic on both side of the server and the client, by targeting both php and neko.
As a novice, I have some doubts. I'm not sure if haxe for php alreadly mature enough for this kinda job. I know haxe is a cousin of ActionScript, it primarily targets AS, and because the author is also the inventor of nekoVM, therefore, these two targets should be fine. But uh, how about php? Is it really good for that as well? Any hints or suggestions? Is haxe's builtin libraries ok for a simple web app or should I use a framework? Does neko have a httpRequest functionality at all?
Much gratitude in advance.
The straight answer is that Haxe/PHP seems to really fit well for you. That because of you background. I used Haxe/PHP in several projects (it happens that I am also its author) and speed has never been an issue for me. If there are bottlenecks usually there are also ways to optimize those portions for better performances, and if in the end you application scales to billions of users you can always opt to switch to neko or a C++/cgi combo.
About the frameworks there are a few options too: Web "frameworks" for Haxe to deploy in a PHP environment?

What are the relative advantages of various Python/PHP web frameworks (particularly for my project)?

I'm deciding on a web framework for an upcoming project, and I'd appreciate any advice. We've decided to use jQuery for the JavaScript, and are heavily leaning toward Python or PHP (more Python) for our server-side logic. I'm especially interested in web2py because of its jQuery integration.
About our project
Our project is to develop a security console for a complex
cybersecurity system operating within an organization's internal
network.
This console will be largely server-driven, as messages come in from the network and must be pushed by the server to the user.
The user will also be able to initiate security actions, the implementation for which will likely be in C++.
The interface we've planned will be relatively rich, and I want to leverage jQuery's power as much as possible.
We have some control over the browser environment we'll be running in (e.g., we don't have to worry about clients with JavaScript disabled).
Our site is likely to have only a few, long-lived client connections.
We are looking for software components with permissive licenses, though we're using some copyleft components (I see that web2py is LGPL while Django is BSD, so +1 to Django)
We have about a month to create a functional demo of our system, of which this interface is a small (but visible) part.
About us
We are two developers with about 5 years of programming experience, but little web development experience. I have several years of Python experience and a summers' worth of experience messing around with PHP. My coworker has some Python experience and has never touched PHP.
I used Django once back in 2008, and was frustrated by the file and code structure, which I found highly unintuitive. Perhaps this structure is inherent to the MVC model (I've had similar experiences with Django and CakePHP since), and I just need to bite the bullet and memorize it.
My Question
Given the information above, what are the relative advantages of the various Python/PHP web frameworks for our project? As mentioned above, I'm especially interested in web2py because of its jQuery integration, though Django's dominance is (once again) hard to ignore.
Thank you very much for your time!
Before deciding on a framework, you should first decide if you want to commit to a language you are unfamiliar with.
You said you've both got minimal PHP experience, so you have to weigh up the advantages here; Will the pros for going PHP (if any) out weigh the amount of time the developers will need to spend to retrain?
(Although depending on your background experience, PHP should be very easy to pick up.)
If you frame it like that, PHP would have to have a pretty convincing offering to give you. From what I'm seeing, specifically Django vs web2py, they both seem very close in functionality - which is good, but doesn't provide the "you must use x!" scenario you may be after.
However, If you will be bringing more people in later and feel finding people to work with web2py will be difficult, it may tip it to PHP. You said your self, Django's popularity (and BSD license) is hard to ignore, and it should make it easier to find people for later expansion.
If it were me, in your shoes, I would go with web2py. Assuming the development team will continue to be Python focused for the foreseeable future.
Python vs PHP: Python
With python, you can always write wrappers for C code so you won't have to mess with starting other processes and passing args to them. That might be useful for your security functions.
Web2py will allow you to easily write a webservice for this too, to more easily integrate the C portions with the web-site infrastructure.
If you already prefer python, I would go with that. If you need to bring on web-developers later that are trained in PHP, teach them Python. It won't take long, and I'm sure they'll appreciate it in the long run. Plus, moving from a PHP MVC framework to web2py or even django would make things easier. I've used CodeIgniter for PHP and find that web2py was so much simpler and easy to understand.
Also as for the directory structure, django is not actually true MVC -- it's MTV (model, template, view).
I find web2py's organization a little more straight-forward. But yes, either way it can seem strange at first. I would say YES, you should bite the bullet and use MVC.
In web2py, the "view" is html markup with the ability to write raw python code. The controller extracts data from the model (database), attaches any needed files (css/js etc) and the model of course simply defines the structure of the data and allows you to access it in an OO way.
Lastly, I wouldn't tip my hat in favor of web2py just because of jQuery integration. It does use it, and a some of the built-in framework stuff (like response.flash/session.flash, the LOAD function that loads a page or data from another controller) rely on jQuery, but using it in another framework only means you have to write an include statement (e.g. ).
But, the way it allows/forces you to focus on development is what takes the cake for me.
I've been using Django as part of my work for a couple years now and truly enjoy it when I can make it work. Unfortunately, and maybe it's just me, but I end up spending hours working on configuration every time I start a new server, or try to make it work in a development IDE.
It's relatively simple to start a new project and start coding. But there are all sorts of little catches that keep things from working if you deviate from the norm. Things like if you want your django project to serve from a subdirectory like example.com/django. The information is out there to make it work. But it's hard to find.
I can't tell you if web2py has those same problems or not. I only just learned about it from your question. It does look slick and simple though. I can tell you that after the hassles of getting the applications to serve properly from whatever server configuration I'm using, django is way more fun to program with than plain php. PHP frameworks may differ.
From my understanding the project not usual web application, you must need event driven program, web server in python.
Django won't help you here.You should look into Flask, Flask has inbuilt console too.http://werkzeug.pocoo.org/, you might need to use twisted, gevent,Flask jquery.
I would recommend asking about web2py on its mailing list -- you'll get lots of help and advice there. Regarding the LGPL license, note that it only applies to the framework, not your application -- you can license your application however you like, including closed source/commercial.
It sounds like you'll need some server push functionality, but if you'll really only need a few long-lived connections at a time, you might not need to bother with solutions like Twisted or gevent. If necessary, though, web2py does include this (requires Tornado, and works using WebSockets, though can be adapted to use other methods).

php vs python django or something else for CMS module

We're looking to develop a CMS module for our website and I need some help in choosing the language/framework for this project. Basically we need to develop a "help' module like this one from ebay http://pages.ebay.com/help/index.html which will contain a lot of static pages with nice URLs for SEO.
The application must run fast using low computer resources.
We have been looking to use php on a custom made mvc framework but we received advice from other sources that py/django is the exactly language/framework that we need in terms of maintainability and development speed because it was developed for exactly this kind of projects so I need an expert advice on this matter with pro and cons for each choice.
It comes down to what your programmer is comfortable with. If you don't have a programmer, find one and ask him/her what she's comfortable working with. The task you're describing seems pretty simple. It can all be done with straight php, python, ruby. Having used PHP, Java and Python, I have a preference for the latter. But as I said, the task is so simple that you can do it without problem in most languages. I suspect that you'll find much more developers familiar with PHP, so you might want to look in that direction.
As far as frameworks go, there again, I don't see much that would require the raw power of an entire framework.
static pages: you need a cms, either custom built or something really lean and dead simple.
clean urls can be achieved with url rewriting (e.g. apache modrewrite directives).
Again, hire the right developer and trust his/her input. Don't go and tell him/her how to work if you don't know how it's done.
I would not say that django was specially developed for this kind of project. There are also great frameworks in PHP like the Zend Framework or symfony, among others.
In the end it comes down to what your production servers offers (but I guess you are free here) and with which programming language you feel most comfortable.
But it is true that Python's structure and style of language makes it fast to program with. (But it probably makes no difference if you are able to program PHP in your sleep ;))

Best way from PHP to ASP.net?

What all is involved if I wanted to switch from PHP to asp.net? I have basicly no knowledge of asp or other languages besides php and some javascript.
What would be the best place to start learning more?
What is needed to host an asp site?
What is it developed with?
Is there an equivalent to php.net for a resource?
I think a good place to start would be to take one of your existing PHP projects, and rewrite it in ASP.Net. That way you wouldn't really be tasked with coming up with something new, and learning a language at the same time. However, don't just try to do a line by line conversion. ASP.Net has a much different programming model than PHP. So you'd be much better off looking at the end product, and trying to produce the same thing, without necessarily producing the same code.
google asp.net c# tutorial. seriously
download ms VS express edition(free) http://www.microsoft.com/express/vwd/
do a project. nothing like learning on the job
I did this switch several times. If you have good grasp of OO and the most common design patterns, you won't have too much of a problem to grasp the dot.net languages.
b.t.w I really REALLY suggest you consider only C#.
Best way to start is take a Wrox book and start learning it. Do not start directly from asp.net, but rather from console applications.
The book will show you how to install a development environment, which is an inseparable thing from the dot.ent env.
If what the book suggests is not the MS express environment, I suggest you use Express.
As far as something like php.net, well, MSDN is by far a better tool then php.net and this is from a PHP freak and ex-Zender.
To sum it up, just do the exercises in the book, it will be OK
I've written PHP web projects for several years and considered myself intermediate with PHP. I recently wrote an application (in PHP) for a company that got noticed by the programming department, and they had me transition to a job programming in C# and .NET.
My first reaction was very standoffish; I learned to program in an anti-Microsoft environment and mindset. The last thing I wanted to do was learn something in .NET.
After several months of forcing myself to learn C# and OOP I have to say it's actually a wonderful thing. At least for developing Windows applications. I'd always wanted to do some desktop applications and this has been a great way to do it.
But so far nothing has involved ASP.net, and now I have a project which requires some web output. I'm struggling with learning ASP, and the fact of the matter is I am tempted to write the web portion of it in PHP. For me, C# makes sense for Windows and OOP, but for quick data-parsing applications on the web, PHP is quick and gets the job done.
I am going to keep working on the ASP thing though, specifically looking at MVC. Another question on SO got me interested in focusing on MVC. I've been perusing books and watching tutorial videos, and so far I am hopelessly confused.
Perhaps it will be something I look back on and am grateful for having made the effort -- like learning C# in the first place. Right now, the ASP approach to web coding seems foreign, despite knowing more about C# and OOP than I did a year ago.
I made the switch from script-based server side languages (Classic ASP and PHP) to .NET a number of years back. If I recall, the hardest part was understanding the tight integration between client-side events and server-side event handling. Once that clicked the rest was just an exercise in learning new syntax (that was actually more like C++ which I learned in college).

Importance of PHP in web oriented platforms

Why is PHP the most used programming language for a web based platform?
PHP:
is easy to learn;
has been around for ~15 years;
runs fairly efficiently;
is cheap to host; and
actually scales really well (some of the largest sites on the internet use it).
PHP is basically the ultimate grass-roots success story.
PHP is:
Built for the web, that is not an extension of an existing language like Perl.
Free of any default framework; this allows it to be fairly lightweight and powerful, a good example of the KISS (Keep It Simple, Stupid) principle.
Because software that values simplicity over everything else propagates faster.
Probably because PHP is easy to learn and it was really simple at first start. With the upcoming of OOP from PHP4 we cannot really say it's simple anymore but at least it tries to keep simple.
Plus from the start the language was really Web oriented, easy access to get/post variables.
You can also note the PHP community is really wide and Zend do a great job to make it a real concurrent of Java/Dotnet/all the others.
Perl/Python/Ruby are also good scripting language but they require some libraries to develop web application
While most CGI language extensions require you to write HTML/JS/CSS within that languages syntax, PHP is able to be used within the contents of an HTML file structure. For someone who doesn't really get the concept of CGI (like I did a while back), it's really nice and offers room to grow with libraries and a universally familiar syntax.
It's also a strategic isue to
choose PHP over Java/Ruby/...
Because you will find PHP
programmers every time, but it is
really difficult to get (cheap)
Java/Ruby/... programmers.
PHP has become the third most be
liked programming language. * **
Its Open Source.
Its old and therefore very stable.
Its the best documented language in the internet.
It has the most string functions (necessary for web/HTML programming).
It has a very huge community, you will find the answer for every PHP question in the internet (or ask stackoverflow).
Its the only language which was designed for the internet.
PHP is fairly easy to install and fairly easy to understand. For that matter, you don't even have to install it. Fifteen dollars a month (or less) will get you a PHP webhost at hundreds of hosting companies.
There are no shortage of "Build a website in 5 minutes with PHP" books. Therefore, it's often the first choice to new web developers or people who want to get something done quickly.
PHP certainly has it warts, but done properly, it can be a good solution as well. Despite its warts, it runs an awful lot of successful websites.
I think it is easy to learn, it is faster, it has lots of forums, it has lots of example codes, it has ...
A lot of emerging php framework like Symfony, Zend, and Cake make rapid development, good mvc design easy. A lot of extremely popular blogging software/cms's are built using php eg. Drupal, Wordpress, and Joomla!.

Categories