Go Back   AnandTech Forums > Software > Programming

Forums
· Hardware and Technology
· CPUs and Overclocking
· Motherboards
· Video Cards and Graphics
· Memory and Storage
· Power Supplies
· Cases & Cooling
· SFF, Notebooks, Pre-Built/Barebones PCs
· Networking
· Peripherals
· General Hardware
· Highly Technical
· Computer Help
· Home Theater PCs
· Consumer Electronics
· Digital and Video Cameras
· Mobile Devices & Gadgets
· Audio/Video & Home Theater
· Software
· Software for Windows
· All Things Apple
· *nix Software
· Operating Systems
· Programming
· PC Gaming
· Console Gaming
· Distributed Computing
· Security
· Social
· Off Topic
· Politics and News
· Discussion Club
· Love and Relationships
· The Garage
· Health and Fitness
· Merchandise and Shopping
· For Sale/Trade
· Hot Deals
· Free Stuff
· Contests and Sweepstakes
· Black Friday 2013
· Forum Issues
· Technical Forum Issues
· Personal Forum Issues
· Suggestion Box
· Moderator Resources
· Moderator Discussions
   

Reply
 
Thread Tools
Old 02-11-2013, 12:58 PM   #1
NickelPlate
Senior Member
 
NickelPlate's Avatar
 
Join Date: Nov 2006
Posts: 539
Default Need help getting started with modern web development

Hi Folks,

It's been a long time since I did basic web sites using authoring tools such as Front Page, Coffecup HTML editor etc.

My work requires me to start learning to develop using PHP and MySQL and I am a complete noob on both topics although not a stranger to programming. I need a way to get started and want to set up a windows based development environment on my local PC. Even though Linux/Ubuntu seems to be the most popular choice for this sort of thing, I want to stick with Windows because that's what I'm familiar with. The learning curve already is seeming pretty steep without having to learn a new OS.

Step 1 is I apparently need web server software and Apache seems the popular choice (I don't know anything about Apache either). However they (Apache or whomever "they" are) don't provide binary installers for their latest version only source code which needs to be compiled first using any number of tools. I have Visual Studio 2010 which supposedly can accomplish this but I'm not sure what "source" file to download from the Apache web site at the below link. There are two Unix source files, a Netware binary and a link to "other" files none of which jumps out at me as being the correct one.

http://httpd.apache.org/download.cgi#apache24

I've run across other websites where people have apparently accomplished this feat and offer these installers but I'm a bit leery downloading them from untrusted sources. It's a shame I can't seem to find a package installer for Windows which provides/installs everything without having to go through all this manual installation hassle that requires all sorts of prerequisite knowledge. How does one get started learning?

Any other suggestions for a complete newb like myself are appreciated .

Thanks,

NP
__________________
i5 3570k @ 4.5Ghz, EVGA GTX670 FTW & Samsung PX2370, Gigabyte GA-Z77-D3H / Hyper 212 Evo, 8GB Samsung 30nm DDR3 1600, WD Velociraptor 300, Win7 x64, OCZ Gamexstream 850W PSU

World Of Trucks Profile
Steam Profile
NickelPlate is offline   Reply With Quote
Old 02-11-2013, 01:35 PM   #2
NickelPlate
Senior Member
 
NickelPlate's Avatar
 
Join Date: Nov 2006
Posts: 539
Default

XAMPP maybe?

http://www.apachefriends.org/en/xampp.html
__________________
i5 3570k @ 4.5Ghz, EVGA GTX670 FTW & Samsung PX2370, Gigabyte GA-Z77-D3H / Hyper 212 Evo, 8GB Samsung 30nm DDR3 1600, WD Velociraptor 300, Win7 x64, OCZ Gamexstream 850W PSU

World Of Trucks Profile
Steam Profile
NickelPlate is offline   Reply With Quote
Old 02-11-2013, 03:22 PM   #3
aceO07
Diamond Member
 
Join Date: Nov 2000
Posts: 4,487
Default

Using Linux is going to make learning this so much easier for you. It's the more popular configuration, so you'll be able to research and get more results/tutorials.

Install vmware player and install Ubuntu 12.04 or other version. Then you can run Linux as a virtual machine on Windows. This is probably the 'hardest' part of getting it running. Ubuntu won't be hard, and there is still Netbeans which you can use as an editor or Eclipse.

Then you'll have access to lots of tutorials that will show you how to get started with php/mysql under Linux.
aceO07 is offline   Reply With Quote
Old 02-11-2013, 05:48 PM   #4
NickelPlate
Senior Member
 
NickelPlate's Avatar
 
Join Date: Nov 2006
Posts: 539
Default

Thanks for the response Ace. I did manage to get XAMPP installed and works pretty good. I went through some basic php/mysql tutorials and am off and running. I'm just using this as a development/educational platform which is why I wanted Windows, and another distribution package I found for anyone who is interested WampServer.

http://www.wampserver.com/en/

I'm not going to set all this up myself in the end though. I just need an environment to learn php scripting and connecting to and managing mysql databases. Once I get my work's application to a point where it's useful, we'll just go to an online hosting service most of which run Linux in a far more secure environment than I could ever manage myself.
__________________
i5 3570k @ 4.5Ghz, EVGA GTX670 FTW & Samsung PX2370, Gigabyte GA-Z77-D3H / Hyper 212 Evo, 8GB Samsung 30nm DDR3 1600, WD Velociraptor 300, Win7 x64, OCZ Gamexstream 850W PSU

World Of Trucks Profile
Steam Profile

Last edited by NickelPlate; 02-11-2013 at 05:51 PM.
NickelPlate is offline   Reply With Quote
Old 02-11-2013, 07:05 PM   #5
Cogman
Diamond Member
 
Cogman's Avatar
 
Join Date: Sep 2000
Location: A nomadic herd of wild fainting goats
Posts: 9,714
Default

Quote:
Originally Posted by NickelPlate View Post
Thanks for the response Ace. I did manage to get XAMPP installed and works pretty good. I went through some basic php/mysql tutorials and am off and running. I'm just using this as a development/educational platform which is why I wanted Windows, and another distribution package I found for anyone who is interested WampServer.

http://www.wampserver.com/en/

I'm not going to set all this up myself in the end though. I just need an environment to learn php scripting and connecting to and managing mysql databases. Once I get my work's application to a point where it's useful, we'll just go to an online hosting service most of which run Linux in a far more secure environment than I could ever manage myself.
Like aceO07 said, you are actually making things harder for yourself by relying on a windows setup for this stuff. It really is a lot easier to do this stuff in linux (learning curve of a new OS and all). The LAMP setup is so common that it isn't even funny. (seriously, I started out doing exactly what you are doing now. Looking back on it, the main thing it taught me was that setting up an AMP architecture on windows shouldn't be done.) It has little to do with security and everything to do with ease of use.

But that is besides the point. From a language standpoint, PHP is a pretty nasty language. I get that you need it for work, however, I would question calling it "modern" as far as web development goes. We are starting to see more Python, Ruby, and JVM languages (Java, Groovy, JRuby, etc) on the web. PHP is a dying web language IMO.

Now for suggestions.

It is VERY easy to write very bad PHP. I would suggest that you do your best not to. If there is one programming principal I would suggest following almost dogmatically, it is DRY (Do not repeat yourself). If you find yourself hitting copy/paste, you are likely making something less maintainable.

For web stuff, it is very important that you separate concerns as much as possible. If you have PHP/HTML/Javascript/and CSS all in one file, you are doing it wrong. Keep things as separate as possible.

For example, it is tempting to write code that creates a table and computes the value of each cell in that table. That is bad. You are mixing business logic with UI logic. The better approach is to have code that creates the data, code that creates the table, and then you feed the table making code with the data making code. The more you separate concerns like this, the easier it will be in the future to do something like change the way a chunk of data is calculated, or change what a table looks like.

Testing. Get in the habit of testing. I'm not a "everything should be tested" sort of guy.. I do, however, find a lot of value in good tests and in writing code that is testable. Tests should be flexible. If a tests fails, it should mean "This code is really REALLY wrong" not "Bob changed a variable name". Write your tests and your code in such a way that swapping out logic will be easy and natural.

While, btw, leads me to this point. Minimize the number of concerns any chunk of code has. Methods that are 100+ lines long are a pain to test and maintain. On top of that, they tend to grow steadily with time becoming ever increasing pains to deal with.

Good luck, have fun, and don't be afraid to play with stuff.
__________________
CogBlog - Random Babblings of Cogman mainly focused on software.
Cogman is offline   Reply With Quote
Old 02-11-2013, 09:41 PM   #6
NickelPlate
Senior Member
 
NickelPlate's Avatar
 
Join Date: Nov 2006
Posts: 539
Default

Thanks Cog. I'm curious what makes it so much easier to setup on Linux though? I literally had XAMPP up and running in minutes which surprised the heck out of me after struggling all weekend with trying to manually install all the components needed. Within the first hour or so I managed to get a basic php script written to connect and display some data from a mysql database which ultimately will be updated from remote machines out in the field and displayed on a web portal. I suppose the reason for choosing php is it's so common with most hosting providers I've been told. So far it seems not too dissimilar from from C which is what I'm most fluent in.

My main job function is not web development but I got nominated because I'm the engineer . I spend most of my time these days writing embedded microprocessor code in C for M2M applications and have a fair bit of controls programming in Codesys and ladder. A lot of your suggestions are good ones though and common practice in embedded systems too. I write a lot of stuff using state machine principles and write with portability and scalability in mind.

Cheers!
__________________
i5 3570k @ 4.5Ghz, EVGA GTX670 FTW & Samsung PX2370, Gigabyte GA-Z77-D3H / Hyper 212 Evo, 8GB Samsung 30nm DDR3 1600, WD Velociraptor 300, Win7 x64, OCZ Gamexstream 850W PSU

World Of Trucks Profile
Steam Profile

Last edited by NickelPlate; 02-11-2013 at 09:44 PM.
NickelPlate is offline   Reply With Quote
Old 02-11-2013, 09:42 PM   #7
PhatoseAlpha
Golden Member
 
Join Date: Apr 2005
Posts: 1,969
Default

Cogman, did you have any experience with Linux when you started testing? There is a world of difference between "Use other OS which I already know" and "Learn new OS too".
__________________
"He is behind me. You are in front of me. If you value your life, be someplace else."
PhatoseAlpha is online now   Reply With Quote
Old 02-11-2013, 11:43 PM   #8
beginner99
Platinum Member
 
Join Date: Jun 2009
Posts: 2,073
Default

Quote:
Originally Posted by NickelPlate View Post
Thanks Cog. I'm curious what makes it so much easier to setup on Linux though? I literally had XAMPP up and running in minutes which surprised the heck out of me after struggling all weekend with trying to manually install all the components needed. Within the first hour or so I managed to get a basic php script written to connect and display some data from a mysql database which ultimately will be updated from remote machines out in the field and displayed on a web portal. I suppose the reason for choosing php is it's so common with most hosting providers I've been told. So far it seems not too dissimilar from from C which is what I'm most fluent in.

My main job function is not web development but I got nominated because I'm the engineer . I spend most of my time these days writing embedded microprocessor code in C for M2M applications and have a fair bit of controls programming in Codesys and ladder. A lot of your suggestions are good ones though and common practice in embedded systems too. I write a lot of stuff using state machine principles and write with portability and scalability in mind.

Cheers!
I'm gonna say for development it does not matter that much if you do it on Windows. The down side is that you might encounter strange issues when moving your code to Linux due to the simple fact that these are different OS and might be running different versions of Apache, PHP and MySQL.

Since you mentioned hosting you need to be aware that depending where you host you won't have control over all settings (Apache, PHP and MySQL) and that can even influence your design.

What I consider problematic is that you are hosting so I assume the app will be freely visible to the internet? This means security will be a huge concern.

You will need to consider this:

https://www.owasp.org/index.php/Top_10_2013-Main

which is in itself a huge topic. The most important part IMHO is SQL Injection. First because it is well known and any half-intelligent 10 year old kid can use it to do harm.
This can at least partially made easier by using a framework. However that required that the hoster allows installing the framework of your choice and that you actually need to learn the framework.
beginner99 is offline   Reply With Quote
Old 02-11-2013, 11:48 PM   #9
beginner99
Platinum Member
 
Join Date: Jun 2009
Posts: 2,073
Default

Quote:
Originally Posted by PhatoseAlpha View Post
Cogman, did you have any experience with Linux when you started testing? There is a world of difference between "Use other OS which I already know" and "Learn new OS too".
I basically had 0 experience with Linux and found it 10 times easier to install a LAMP on Ubuntu Server (no GUI) than WAMP. (if you ignore WAMP, XAMPP etc. which are not usable for production). Installing PHP and Apache on Windows was a pain and often it was difficult to find your extensions that were compiled in the exact right way you require for the right apache or php version.
beginner99 is offline   Reply With Quote
Old 02-12-2013, 01:25 AM   #10
watdaflip
Member
 
Join Date: Feb 2013
Posts: 25
Default

I haven't checked for anything better in years, but my go to PHP tutorial site is http://www.tizag.com/phpT/

PHP is back end programming, it's only half of what you have to do with web development.

Modern web development will involve HTML (most likely HTML5), CSS, and Javascript for client site dynamic functionality. You can use Java and Flash for front end assets as well, but JS will fit your needs in most cases. (Personally, I'd avoid Java applets completely, especially since Oracle bought Sun, especially with recent security issues).

In addition to these different technologies/languages, you have worry about browser compatibility. Javascript and CSS in particular have set standards which browser should abide by, but not all of them do (or at least not all version do). You need to determine your target market for the website, as well the what browser and version they might be using so if it's worth supporting. Supporting a browser might involve browser specific fixes, many of which you can find from a google search, finding people who have had similar issues.

You can choose to support only modern browser, or legacy browsers such as ie 6 & 7, and Firefox < 4.x

As far as runtime environment, even if you don't have to worry about getting servers up and running with Linux, it might be worth your time to get a dev environment running on Linux as it's very possible there might be bugs on that environment you can help fix. For instance, with my job, if I didn't have any knowledge of Linux, having 75+ servers running PHP on a linux machine and a bug comes up from code I deployed, it would suck to not have any knowledge to help fix it. It might not apply to you with your job, but it can definitely be helpful to assist in debugging what is happening on your production servers. I would seriously recommend developing on a mac/linux if your production servers are going to be running linux. If you will be deploying on Windows/ISS, then you should be set with a WAMP setup.
watdaflip is offline   Reply With Quote
Old 02-12-2013, 08:03 AM   #11
Cogman
Diamond Member
 
Cogman's Avatar
 
Join Date: Sep 2000
Location: A nomadic herd of wild fainting goats
Posts: 9,714
Default

Quote:
Originally Posted by NickelPlate View Post
Thanks Cog. I'm curious what makes it so much easier to setup on Linux though? I literally had XAMPP up and running in minutes which surprised the heck out of me after struggling all weekend with trying to manually install all the components needed. Within the first hour or so I managed to get a basic php script written to connect and display some data from a mysql database which ultimately will be updated from remote machines out in the field and displayed on a web portal. I suppose the reason for choosing php is it's so common with most hosting providers I've been told. So far it seems not too dissimilar from from C which is what I'm most fluent in.
There wasn't an XAMPP when I first got into this stuff. So from that perspective, there were a lot of different binaries that you had to get and place in the correct directories. Random files also needed to be configured differently on windows than on linux. On top of that, most documentation available at the time assumed that you were running a linux system, so there was a lot of annoying things in the window system that you had to care about that were practically undocumented.

With most modern distros, the installation of those products boils down to running the package manager and telling it to install the packages you care about. Yeah, there was SOME configurations that you needed to do, but it was configuration that needed to be done on both windows and linux.

Quote:
My main job function is not web development but I got nominated because I'm the engineer . I spend most of my time these days writing embedded microprocessor code in C for M2M applications and have a fair bit of controls programming in Codesys and ladder. A lot of your suggestions are good ones though and common practice in embedded systems too. I write a lot of stuff using state machine principles and write with portability and scalability in mind.

Cheers!
Gotcha. I wasn't sure where you were coming from. IMO the general principles are really about the only tutorial you need. After that, most languages are really pretty easy to pick up after a couple of tutorials.

Just be careful with SQL injections (as someone else mentioned) it is one of the biggest problems of the Internet even today and it is very easy to do. The issue is that writing code that can be injected into is generally much more intuitive than writing code that is safe from injection attacks.
__________________
CogBlog - Random Babblings of Cogman mainly focused on software.
Cogman is offline   Reply With Quote
Old 02-12-2013, 08:08 AM   #12
Cogman
Diamond Member
 
Cogman's Avatar
 
Join Date: Sep 2000
Location: A nomadic herd of wild fainting goats
Posts: 9,714
Default

Quote:
Originally Posted by beginner99 View Post
I basically had 0 experience with Linux and found it 10 times easier to install a LAMP on Ubuntu Server (no GUI) than WAMP. (if you ignore WAMP, XAMPP etc. which are not usable for production). Installing PHP and Apache on Windows was a pain and often it was difficult to find your extensions that were compiled in the exact right way you require for the right apache or php version.
Yup, that was pretty much my experience. Getting everything in the right place and then setting things up was just a pain. Once it is done, it wasn't too bad, but getting to the "it is done" stage was just yucky.

I did this in the era when perl was a big web language as well, so I had both perl and PHP installation steps going.

It wasn't until much later that I got into linux. At that point, it was pretty shocking how easy installing those system were compared to the windows alternative (Even compiling things from source was much easier).
__________________
CogBlog - Random Babblings of Cogman mainly focused on software.
Cogman is offline   Reply With Quote
Old 02-12-2013, 10:30 AM   #13
AyashiKaibutsu
Diamond Member
 
AyashiKaibutsu's Avatar
 
Join Date: Jan 2004
Location: Maryland
Posts: 8,580
Default

Quote:
Originally Posted by Cogman View Post
Just be careful with SQL injections (as someone else mentioned) it is one of the biggest problems of the Internet even today and it is very easy to do. The issue is that writing code that can be injected into is generally much more intuitive than writing code that is safe from injection attacks.
As long as you cleanse your database parameters you won't really need to worry about that. I know using parameterized sql statements in c# cleanses it. I suspect it does in java as well although I haven't really looked into how my code isn't injectable (using a lot of code someone else wrote). Main thing is to just make sure raw user input never gets sent as a sql statement.
__________________
The large print giveths and the small print taketh away.
AyashiKaibutsu is online now   Reply With Quote
Old 02-12-2013, 04:05 PM   #14
Cogman
Diamond Member
 
Cogman's Avatar
 
Join Date: Sep 2000
Location: A nomadic herd of wild fainting goats
Posts: 9,714
Default

Quote:
Originally Posted by AyashiKaibutsu View Post
As long as you cleanse your database parameters you won't really need to worry about that. I know using parameterized sql statements in c# cleanses it. I suspect it does in java as well although I haven't really looked into how my code isn't injectable (using a lot of code someone else wrote). Main thing is to just make sure raw user input never gets sent as a sql statement.
If you are sending in data, you should always use parameterized sql. Every library that I've seen which does SQL stuff supports this. It doesn't even really cleanse the string so much as signal to the DB "This is what I'm executing and this is the data that is coming in". The separation of data and commands is the key that keeps things safe.

However, rolling your own (something like "replace("'", "''")") is doomed to failure. There are just WAY to many ways that someone can encode their data to bypass that sort of cleansing.

In general, when it comes to user input/output you should try and avoid doing your own thing, you will almost assuredly get it wrong or miss some corner case.
__________________
CogBlog - Random Babblings of Cogman mainly focused on software.
Cogman is offline   Reply With Quote
Old 02-13-2013, 08:45 AM   #15
NickelPlate
Senior Member
 
NickelPlate's Avatar
 
Join Date: Nov 2006
Posts: 539
Default

Good discussion so far. Thanks for the info on the SQL injection. Interesting reading and I had no idea but I'll be sure to read more about it. My hope eventually once I get this working on a basic levl is to hand it off to someone who knows more about it than I do to not only pretty it up (because it's going to look like an engineer did it ), but also make it more secure.
__________________
i5 3570k @ 4.5Ghz, EVGA GTX670 FTW & Samsung PX2370, Gigabyte GA-Z77-D3H / Hyper 212 Evo, 8GB Samsung 30nm DDR3 1600, WD Velociraptor 300, Win7 x64, OCZ Gamexstream 850W PSU

World Of Trucks Profile
Steam Profile
NickelPlate is offline   Reply With Quote
Old 02-13-2013, 01:42 PM   #16
tfinch2
Lifer
 
tfinch2's Avatar
 
Join Date: Feb 2004
Posts: 22,048
Default

Take the time to learn some PHP, then adopt a framework. Chances are, someone has already done what you want to do.
__________________
unban ^[a-zA-Z0-9]+$
tfinch2 is offline   Reply With Quote
Old 02-22-2013, 03:52 AM   #17
tech7
Junior Member
 
Join Date: Feb 2013
Posts: 7
Default

There's nothing wrong with developing in a Windows environment. XAMP is a good choice to quickly get setup and hitting some tutorials but in the future you might want to look into installing Apache, PHP and MySQL yourself (it's really easy) and you have complete control over your system. I don't think having the most up to date version of Apache is a major issue - you probably won't make use of any missing features anyway. Unless there are any major reasons not to use the version available (such as security issues).
tech7 is offline   Reply With Quote
Old 02-28-2013, 01:17 PM   #18
ButterRum
Junior Member
 
Join Date: Feb 2013
Posts: 16
Default

It sounds like you want a development server to practice Web coding. If I understand the question, Then you do not need to worry much about the deep sysadmin. It shouldn't matter if you have Windows or Linux. You can Web program on both – however, Microsoft does have their own stuff such as ASP.net (which isn't very modern anymore).

But yeah, you can learn any programming language on Windows and port the code to a Linux server. You'd have to make a few adjustments such as file locations but nothing too drastic.

You can download stacks at http://bitnami.org

Bitnami pretty much creates your own development server on your localhost. It works great.

Also, engineers should be able to grasp higher-level languages, and I'd imagine they'd have potential to write more efficient code than non-engineers.

Last edited by ButterRum; 02-28-2013 at 01:20 PM.
ButterRum is offline   Reply With Quote
Old 02-28-2013, 01:50 PM   #19
DaveSimmons
Elite Member
 
Join Date: Aug 2001
Location: Bellevue, WA
Posts: 36,855
Default

I prefer Apache Friends / XAMPP to binami -- last time I tried bitnami (admittedly a couple of years ago) their package was missing some PHP features I needed like libmcrypt.

XAMPP is run one install script and go.

For windows development, the main gotcha I've found is remembering that the Windows file system ignores case. That means:

- You can't have 2 pages HELLO.php and hello.php. Not that you should , Windows would see these as a single file.

- If you are sloppy, that means you could write file access code with incorrect names (HELLO.dat vs. hello.dat) that works under Windows but fails for linux when you move it to a production server.

Besides that, if you need to run something external using a shell command, you won't have the right set of programs (Windows vs. Linux).
DaveSimmons is offline   Reply With Quote
Old 03-01-2013, 05:44 PM   #20
rozkan
Member
 
Join Date: Mar 2013
Location: Michigan
Posts: 44
Default

NickelPlate, what exactly are you going to need to do once you learn PHP/MySQL? Because, as far as I read this thread, I don't really see why a company would try to make a web developer out of an engineer? I mean, a web developer is a usually a full time worker who write and/or maintain code. Don't tell me that the company needs a website and they figured it would be more cost efficient to turn an engineer into a web developer (because it is not).

Also, I see no reason to try to learn Linux while you are already trying to learn web programming. Benefits would be marginal, if any. Use wampserver to test your code, PHP will do fine in most cases and is NOT going anywhere at least for another decade.
rozkan is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:39 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.