Upgrading to PHP 5.3 in Ubuntu

I’ve been using PHP 5.2 for a long time now. I’m not so apt towards change but PHP 5.3 has some cool features which I needed very much for my projects. So yesterday I decided to do that conversion. The process was not at all so simple and it took lots of googling and searching the forums, especially for removing the post-installation bugs. Finally, at Dec 27 12:45 AM I achieved 100% transformation to PHP 5.3. As my usual habit, I like documenting the stuff I do, so here it goes.

First thing before starting the process is to make sure that none of my existing projects would break. Because as the developers have said, PHP 5.3 is a major release with lots of changes. Many new features were added while many were removed or deprecated. And to avoid getting unnecessary warnings or notices, it was better to recheck my codes for compatibility with PHP 5.3. The PHP developers have written a good page in the PHP Manual which tells in detail about the things to take care of when migrating to 5.3 from 5.2. You can check it here : http://php.net/manual/en/migration53.php

So don’t forget to go through that page once, at the least the section which tells about the “removed and deprecated” features in PHP 5.3 and use the alternatives as suggested. Now you’re ready to upgrade. BUT, before that, you’ve to know that any software you use like phpMyAdmin or ldapPhpAdmin which uses PHP might broke. Well, you cannot do anything about it but you’ll have to reinstall them. Anyways, moving ahead, take a backup copy of your php.ini configuration file. You may need it for reconfiguring your PHP 5.3. If you’re using Apache 2, it can be found in /etc/php5/apache2/php.ini

Now, just run the following commands one by one,

Continue reading

Advertisements

Quickly configuring an LDAP + NFS client in Fedora

Recently I needed to configure 6 PCs for a central workplace. I needed central authentication as well as Network File System(NFS) on all those machines. All this was to facilitate the people of my technical club (the “Delta Force” Webteam) to use those machines for working on collaborative projects. The central authentication assured that I can easily manage user accounts from say, an LDAP server i.e. I can disable login of a user in a client machine or create a new user without having to touch the client machine at all. Similarly, NFS assured that no matter in which of those 6 machines the user logs in, he will always see the same files in his home directory and same configurations like his background-image, firefox addons, etc on that machine as if he always used the same computer for all his work. This eliminates the problem of people complaining that the machine in which their files resides are being used by someone else.

So my overall network configuration has the following prototype :

1) 6 client machines in which user will be able to login (Subnet of the machines : 10.1.39.0/24)
2) An LDAP server ( IP : 10.0.0.163 ) to take care of authentication when user logs into a client machine
3) The LDAP base DN which has the list of all users is ou=people,ou=delta,dc=ldap.delta.nitt,dc=edu
4) An NFS server ( IP : 10.0.0.126 ) which has the user home-directories of all users inside /webteam folder.
Overall working : When a user (say “jereme”) logs into a client machine, his username and password are checked from the LDAP server at 10.0.0.163. If authentication is successful, he’s logged into the machine and his home directory is actually mounted from /webteam/jereme in the NFS server at 10.0.0.126.

I assume you already have the fully configured LDAP and NFS servers since this article is only about configuring the “clients”. So here we go. Pick any of your client machines and do the following :

First we will configure NFS client. For this purpose, we will use the autofs package.

Continue reading

Connecting MTS Mblaze USB Modem in Ubuntu

I recently bought myself an MTS Mblaze wireless USB Modem. Connecting it on Linux was difficult because there was practically no tutorial for MTS USB Modem, while many were available for Reliance and Tata Indicom Modems. So here is what I did to finally get it connected (Note : Execute all commands as ROOT )

i) You’d have to install the package USB-ModeSwitch. It is available here : http://packages.debian.org/sid/usb-modeswitch

Note : When you open the above link, you should check out its dependencies and also install the dependency package ” usb-modeswitch-data”.

Just download and double-click on it to install the package.

ii) After you’ve installed usb-modeswitch and usb-modeswitch-data packages, reboot your computer.

iii) Connect the Mblaze Modem and wait for 30 seconds. While you’re waiting, the usb-modeswitch package is doing magic in the background, you can check the status through the following command :

dmesg

iv) I hope you have “wvdial” pre-installed on your system. You can check that by typing “wvdial” and see if the computer recognises it. If it doesn’t then you’d have to install it. Its easy, refer this link.

v) Now edit the file /etc/wvdial.conf (If it doesn’t exists, then create it) as Root and copy paste the following code :

[Dialer cdma]
Stupid Mode = 1
Inherits = Modem0
Password = mts
Username = internet@internet.mtsindia.in
Phone = #777

[Modem0]
Init1 = ATZ
SetVolume = 0
Modem = /dev/ttyUSB0
Baud = 115200
FlowControl = Hardware (CRTSCTS)
Dial Command = ATDT

Note that ttyUSB0 may be different for your system. However, first try with the above code, if it doesn’t works and says some error like “ttyUSB0 doesn’t exists” or something similar to it, then find out the actual one by going through the output of following command :

dmesg | grep -e “modem” -e “tty”

vi) That’s it, you’re done. Now start browsing with the following command :

wvdial cdma

As soon as you start seeing some IP addresses, you’re online! DO NOT close the terminal in which you executed the command, otherwise you will get disconnected.

And from next time, you don’t have to it all over again. Simply connect your modem, wait for 30 seconds and type the last command. To disconnect, goto the terminal, and press Ctrl + C.

Hope it worked for you, if any problems occured, you can leave a reply !

Setting up Reliance/TataIndicom Wireless Internet in Ubuntu

It is very easy to setup a wireless internet connection using your Reliance or Tata Indicom DataCard on your Ubuntu running PC. I’ve myself faced a lot of problems and finally here I am with a well-researched solution. I’ll try to simplify it as much as I can but it is not an easy job. Its going to be a little scary, but don’t lose hope and try finishing steps 1 to 6. Now start following the steps :

Step 1 : (Optional) I’ll strongly recommend you to upgrade your Ubuntu to latest Ubuntu 9.10. If you have not done it yet, I assure you that this will make your life much easier.

Step 2: Download the package ‘wvdial’. If you have an internet connection (may be DSL on ubuntu),  execute the following command :

sudo apt-get install wvdial

However, if you can’t connect your Ubuntu PC to internet for some reason then you’d have to install wvdial manually. This may take some of your time, patience and skill. Refer this article.

After you’ve downloaded and installed wvdial, tighten your seat-belts because its going to be a hell of a ride now!

Step 3 (Don’t Panic!): Now, plug in your Reliance or Tata Indicom data card into one of your USB slots.

TARGET : Determine the name of the port you connected it to. Seems easy, doesn’t it? You’ll see …

There are 3 ways to do that – (a),(b) and (c). Start with (a) and go to the next one only if the previous one fails.

Continue reading

NewFolder .exe Virus

Here’s a useful tool I recently discovered for all you poor guys who have been troubled by the naughty NewFolder .exe Virus. What is a NewFolder .exe virus ? Well, as the name says it appears as NewFolder .exe in your folder. As soon as it lands in a folder, it scans the folder for subfolders recursively, and inside every folder it finds, it will create a copy of itself with the same name as the folder name. Writing this virus is just as easy as removing it. But in this short article, I’ll talk about how to destroy the virus not create.

I assume everyone must have had an encounter with this virus once in his lifetime. Removing this virus can be very irritating, even if you are a linux user. Ofcourse, when you’re in Linux , all you have to do is go to each of the folder, select the virus and simply delete it. But imagine what’ll happen when the virus has already spread across your hard drive or prendrive, spanning thousands of folders and made so many copied of itself.

Obviously you’re not going to go by this naive approach again. If you’re good at shell, writing a script isn’t a big deal. But if you’re even better in Linux Basics, then you should know that just 1 line of code is enough to remove this virus completely from your drive. All you have to do is to search & destroy the virus recursively.

Searching : How to search ? Well there are 2 ways. Way 1 is to check the name of the folder and then scan the folder for a file named .exe. If its there, then its the virus. Implementing this way will definitely take you more than 1 line of code. The simpler way to do is to forget about the folder and just search for all file names which matches the pattern ” * .exe ” (quotes for clarity). The important point to be noted here is that this virus, while creating the copy of itself, always adds a space before the “.exe” file extension. No other windows file generally have a space before .exe extension (unless you created it yourself).

Destroying : Just redirect the output of the search code to a “rm” command.

Just go to the directory in which the virus exists and execute the following code :

NOTE : There is a SPACE between “*\” and “.exe” (quotes for clarity).

find -name “*\ .exe” -exec rm -rf {} \;

PS : This code will find and delete all the file names with an extension of exe and a space before .exe in the filename. So make sure you don’t have any of your personal files with this kind of name pattern. Just make sure that there’s no space before the .exe extension in the file name. If you’re not sure, I’d recommend you take a backup before executing this code.

Ubuntu vs Fedora ?

Given a choice what will you chose, Ubuntu or Fedora ? Its one of the most arguable question among Linux Users. In this article, I try to talk about what I feel would be the best choice.

For those who have no idea about the title of this article – Ubuntu and Fedora, both are Operating Systems based on Open Source Linux Kernel. They are totally free of cost and belongs to a category called “FOSS” (Free and Open Source Software). Google for more.

I have been a frequent user of both Ubuntu and Fedora. While my laptop Dell Inspirton 1525 has both Ubuntu 9.04 Ultimate Edition 2.3 and Windows Vista Home Premium, I rarely use Windows. The only 2 things I open windows for are Microsoft Word and Gaming, because I feel that Sun’s OpenOffice is still too far behind the MS Word 2007 in terms of looks and user-friendliness and the Linux based Gaming is still in its infancy. Earlier I used to go to Windows for other needs as well like running HD Movies, using my Reliance/Tata Indicom Wireless Datacards, using Adobe PDF Reader, etc. but as soon as I grabbed the Ultimate Edition 2.3 , I almost forgot I had windows installed too!

According to my experience, Ubuntu is better than Fedora for normal desktop users. Ubuntu is officially a “home-based desktop operating system”, that is supposed to be user-friendly and provide all features that a desktop user requires like multimedia, networking, utility tools, office tools, etc. So in any case, if you’re a newuser on Linux, you should pick a flavour of Ubuntu. I’d recommend Ultimate Edition 2.3, which I am currently using. It has already got preinstalled all the softwares you’d ever need in your PC, except for games ofcourse. Even more, its looks are comparable with Windows and is more stable and user-friendly than other flavours. Besides, you can also pick among Linux Mint, Ubuntu 9.04, and others, but I don’t think anyone of them can beat Ultimate Edition in terms of preinstalled applications. Ubuntu flavours  in general, are simple, easy to use and user-friendly.

On the other hand, Fedora was actually a “sand-box” operating system when released, meant it was supposed to be for testing and experimenting Linux Softwares. It was never supposed to be for normal home based desktop users. Its meant for those who have advanced knowledge of Linux and can tweak fedora to their needs. However, with time it has incorporated lots of features meant for normal users which has made it the most widely linux OS used second only to Ubuntu.

When comparing security, both Fedora and Ubuntu provide you the same protection. Infact, any Linux based OS will give you security far better than that provided by Windows. I also include viruses, spamwares, adwares, etc while talking about security. Linux OS basically renders them non-executable in the first place, so no question arises of removing them.

All in all, I can summarize as follows :

If you’re a newcomer to Linux, use Ultimate Edition 2.3. You can also try Linux Mint, which has got even better GUI features but software-wise its little below Ultimate Edition.

For advanced users, who are ready to start off with the most stable Linux OS, just install Ubuntu 9.04 also known as “Jaunty Jackalope”. Ultimate Edition 2.3 uses Ubuntu 9.04 at its base, so I suggest its better than any other flavour. However, if you chose to install Ubuntu 9.04, you’d have to install every software, codecs you need by yourself. This may look to you as a negative point, yes it is if you don’t have a net connection, but otherwise, installing applications in Linux is as fast and simple as cutting a cake! Seriously, all you need to do is to open terminal and type the following command :
In Ubuntu :

sudo apt-get install packagename

In Fedora :

sudo yum install packagename

Thats all you have to do! Terminal will automatically download the software form the net and install it on your PC without you having to interfere in between. But you should know just one thing – the “package name”. Finding the exact package name will cose you less than 10 seconds in google.

In Ultimate Edition 2.3, you have got more than enough softwares than you’d actually need. There’s no point of having so many softwares ofcourse. I actually use less than 30% of the softwares available in Ultimate Edition.

Finally, for office users, Fedora should be the first choice. I am not sure why Fedora is best for office system, because personally I don’t find anything in Fedora that I can’t do better in Ubuntu. But still, people have their reasons to support Fedora over Ubuntu. No one has any concrete point but critics always say! Make your own choice and best of luck!

Still not sure, Click Here for answers!

Making a repository DVD in Ubuntu

In order to take the backup of all the packages I installed in my Ubuntu system, I wanted to make a portable DVD that I can use as a repository having all the packages I downloaded. After reinstalling Ubuntu, I should only insert that CD-ROM and issue the command :

sudo apt-cdrom add

This will automatically install all the packages from the CD-ROM Repository into the system and the best part – It will take care of all the dependencies by itself !! [:)]. But if you try to manually burn all the packages right from where they are stored /var/cache/apt/archives into the removable media, then when you’re reinstalling those packages , it will push you into the dependencies hell, where you will be irritated to death !

So after much googling, I was able to find out the proper way of making a Repository CD in Ubuntu. So here it goes :

1) The first thing you have to do is to become root, because all the below steps will require you to have root privileges.

To become root for this session, issue the following command :

sudo -s -H

2) Next step is to install the package apt-move. It is available in the Universe Repository. Since you’re root already, you won’t have to use sudo anymore. If you are connected to internet, run :

install apt-get apt-move

3) Now change the setting in the configuration file of apt-move located in /etc/apt-move.conf . Open it and look for COPYONLY=no and make it to COPYONLY=yes. You can change more settings in the file as you want it, but in most cases, that won’t be necessary. This change was important because if you miss to do so, then while creating the CD-Repo , it will delete all the packages from /var/cache/apt/archives. And that is not you want. NOTE : Making the above changes will require you to have root privileges. You can use vim or nano from the shell itself.

4) Now this is the time to select all the packages you want to put into your own RepoCD.By default, if you don’t do anything, all the packages inside the folder /var/cache/apt/archives will be archived. But if you want to exclude some of them, then simply delete them from the folder /var/cache/apt/archives . Don’t worry, you can safely delete them. Its just a cache of all the packages. They’re not important anymore as their binaries have already been integrated with your system.

Continue reading

Ubuntu and a Scratching noise !

Well, this might prove to be the worst night-mare for some of you long-time Ubuntu users.

My laptop has been running on Ubuntu (Hardy Heron ) for around 3-4 months. Ever since then, I’ve been ignoring an unusual noise coming from my harddisk , taking it to be the normal noise for any harddisk. But finally, I decided to google upon it, and what I found scared the hell out of me. In some cases (not all), the noise that is coming is coming due to frequent physical collision of the read/write head of your harddrive with the disc. This happens whenever the read/write head of your harddrive is parking itself more times than it should do optimally.

If you dont know about Parking, then Parking is a process by which your harddrive tries to save power. Usually, the read/write head is always roaming over the rotating metal disks, whenever the harddrive is in use. But when it is idle, the heads are “parked” or moved to a “parking place” present in the harddisk, where it can rest till they’re in need of use again. This saves power but decreases performance.

So If you’re dying to save power and you’re ready to compromise performace for that, then you should want your rw-heads to be parked whenever they finish their job. But as you know, when your computer is ON and you’re using it, then the harddisk gets very little time to rest. This is because almost every action of yours like listening to music,surfing the net,gaming,etc and other heavy-weight applications, requires harddisk for storing cache, temporary data and accessing & updating their core drivers, etc.

Even when you’re not using your computer, most of the time many other activites are going inside it, which are all scheduled using cron/anacron/etc. And if you have configured for “maximum power conservation”, then this means that you’re rw-heads are parked, then again unparked to do some job, then parked again, and again and again. And this means “frequent” collisions of your rw-heads with the discs which happens during every parking/unparking.

All this happens when the default configuration in Ubuntu harddisk driver isn’t compatible with the type of harddisk you use. The another possible reason is that your harddrive , is indeed already faulty. But If it’s not, then it is on its way of becoming one.

Continue reading