Categories
PHP

My LAMP Environment

Today, I am gonna share a short overview of my work environment. I’m gonna detail on how you can setup yours too. First lets get to the L part. I am running Ubuntu Linux 11.04. Well, I do hate the default Unity UI. But good lord, we have the fall back options like “Ubuntu Classic” which is Gnome I believe. After installing Ubuntu, I installed the LAMP server using the “tasksel” utility. I love it because it’s handy and lets me do all sort of package management and software installation based on the nature of task. By default, in Ubuntu 9.10+ versions, we no longer have “tasksel” installed by default. So, open your terminal and get the utility from the repository by executing the following command:

Now that we have tasksel installed, we can install all the packages necessary for LAMP server using another handy command:

Man, I love this terminal and command line geekery! It’s just feels like magic! We’re done setting up the LAMP server. Visit : http://localhost/ and you’ll get the local web page 🙂

Now, the www folder is located to “/var/www” which is owned by the user “root”. So, we take the ownership :

Aha! Now you can create files and directories in the www directory and enjoy!

Well, now if we need to enable a custom apache module, we do this:

It’ll display a list of available modules, type in the ones you need and press enter. After selecting the modules, type this command to reload apache:

Now that we have apache, mysql and php running, lets install some GUI tools for mysql. Here goes the commands:

So far we have installed the basic tools, now lets install PEAR 🙂

Now that you have PEAR, we can install a nice utility – “pman”.

Pman is handy for command line php documentation. Just try like this:

It’ll give the docs for the strlen function on the terminal just like the linux man utility 🙂 Press “q” to quit the man page.

By default, php doesn’t come with curl and gd in linux. Install them like this:

Now that we have a working LAMP setup, lets get some additional tools: SVN, Git and Filezilla.

Ubuntu has Gedit, a text editor with Syntax highlighting. While Gedit can be used for PHP development, most of the popular PHP IDEs have their Linux version. I have used both Netbeans and PhpStorm on Ubuntu. And I know Eclipse run on Linux as well. So fire up your favorite IDE and storm the LAMP arena! 🙂

Categories
Uncategorized

Remote connection to Visual Studio Development Server: The easy Way!

Let me explain the scenario. I am a novice .NET developer. I have picked up the .NET framework a couple of weeks ago. I am well versed in PHP and Python and have worked on the LAMP stack so far. I use Pay monthly websites, cause as a developer I know what’s the best way I could save a ton of money and make more profits. I am relatively new to the Windows and Visual Studio environment. I have tasted many technologies and I love experimenting. Web Application Development being my primary concentration, I decided to give Visual Web Developer a try.

I have Visual Studio 2010 Ultimate installed on a Windows 7 Notebook. I actively develop PHP MySQL apps on the same PC. I am a BTCL ADSL subscriber and have a Belkin N Series router. With my WAMP Server, the apache can listen to my ISP IP address and anyone can visit my local web apps over the internet using that address. That’s pretty cool! Since I am a beginner, I decided not to install IIS and stick to the development server of Visual Web Developer (or VS). For security reasons, the dev server listens only to internal ports and refuses remote connection. Duh! I don’t want to pay for Windows hosting just to show off how fast I am learning!

After browsing the internet for a while, I came across a tool :- SPI Port Forward. It can forward any ports on the machine to any other ports on another host. Pretty cool! Remember, localhost is a host that has an IP address 127.0.0.1. This IP address is internal, that is available only to your machine. So, we can fool VS by forwarding any incoming connection to a port on localhost. VS will think that this is an internal connection. 🙂 Yeah, it’s that easy!

So what do we do? We download the stand alone SPI Port Forward Utility. We map a port on our pc (say, 3500) and map it to the VS dev server port. But, wait! VS uses random ports for running the app. How do we forward the port? That’s easy. Just go to the project properties, go to the “Web” section and define a fixed port under the “Server” section. Cool!

Now, note that, you can not forward port 3500 to 3500. After all its the same machine. So I launch VS on port 8000 and use the port 3500 for accepting incoming connection. By the way, since I am inside another Wireless network, I had to setup the router to forward all ports to my Notebook PC at the first place. That’s it! We’re done.

What happens now? When someone visits your ISP IP address, the request is made to your router. Your router forwards it to port 3500 to your machine. Your machine forwards it to the internal port 127.0.0.1:8000 where the VS Dev server is running!

Now you can show the world off your .NET skills! Have fun 😀

Categories
PHP

Running WAMP Server at Windows Startup

While using Linux, the LAMP stack was always ready to work on. But on Windows, I have to manually start the WAMP server. This is a pain in the ass! 😛

Today I found a way to run WAMP server at startup. I’m going to share how.

# Go to start menu.
# Right click on My Computer
# Click Manage
# In the “Services and Applications” section, find “wampapache” and “wampmysqld”.
# To start these services on Windows Startup, double click on each of them, set startup to Automatic.

Restart your PC to see if it works 🙂

PS: We are only starting the apache and mysql servers on startup. So don’t expect the WAMP icon in the taskbar. Visit localhost to see if the server is online 🙂