Upgrading to PHP 5.3 for CentOS

I wanted to try WordPress 3.2 beta but realized that it requires at least PHP 5.2 and I’m still with 5.1.6 (the one that comes with CentOS). Here’s what I got from the interwebs.

Step 1: Get webtatic PHP 5.3 Repository
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

Step 2: Update PHP
yum --enablerepo=webtatic update php

Step 3: Verify PHP version
php -v

Expected result should be like below

PHP 5.3.6 (cli) (built: Mar 19 2011 08:30:07)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

*** NOTE ***
Though webstatic stated that the repository is created for CentOS 64bit, it still worked for my 32-bit installation.

Source:

http://www.webtatic.com/packages/php53/

Incoming search terms:

  • webtatic php 5 3
  • centos 5 7 php 5 3 repo
  • php53 centos webstatic
  • repo webstatic
  • repository php 5 3 9 on centos 6
  • update php 5 1 to 5 3 centos 64bit
  • update php 5 3 webstatis
  • update php to 5 3 centos 64 bit
  • upgrade php 5 3 centos64
  • use webstatic php webtatic

Run SQL Script via SQL*Plus via Prompt

If you want to run an SQL script via sqlplus in the shell prompt, the command is as below.

sqlplus user/pass@connect @scriptname

Don’t forget that there should be an exit command at the end of the sql. Otherwise, the sqlplus will not exit and just stop running until you manually call exit.

Now, if the SQL script does not have exit at the end, you’ll have to do the following.

echo exit | sqlplus user/pass@connect @scriptname

This is another trivial thing that can be easily forgotten.

Incoming search terms:

  • sqlplus does not return
  • sql script name in shell script exit from sql prompt
  • sqlplus -s << end in shell script
  • sqlplus does not call script
  • execute sql script in shell
  • sqlplus invoke shell script
  • sqlplus no exit on end of script
  • sqlplus prompt exit
  • sqlplus run sql script
  • script sql *plus

How To Repair Ubuntu Netbook After Upgrade Problem (WUBI)

As I have posted earlier, Ubuntu upgrade broke my installation and I had to reinstall everything from scratch. And guess what, it happened again! This time, I’ve some important files in the filesystem. And since it happened the second time, it can no longer be said as an accident. Something breaks during the upgrade and it must solved or at least mitigated the next time. And apparently, I’m not the only one affected and there are at least three bugs reported already.

Here’s the list of bugs.
610898
Bug 13288
653134

Meanwhile, a solution/workaround has been posted at ubuntu forum. Click here to view the thread. If you are too lazy to open yet another window/tab, here’s what fixed my Ubuntu install.

Problem #2:

You have Wubi installed and are able to boot Windows normally.

However, attempting to boot Ubuntu leads to a number of possible failures including, but not limited to, the following:

computer reboots without user interaction, a black screen with or without any error messages, loadfont errors, file not found errors, and the like.

These issues affect the following versions: 10.04, 10.04.1, and 10.10

The solutions for each version are somewhat different and will be noted next to the relevant solution.

Solution #1 (10.04):

If it is a 10.04 install, the fix is to boot an Ubuntu LiveCD/USB, loop mount the wubi root.disk and manually edit the grub.cfg file.

Here’s the steps

sudo mkdir /media/win
sudo mount /dev/sda1 /media/win
sudo mount -o loop /media/win/ubuntu/disks/root.disk /mnt
sudo cp /mnt/boot/grub/grub.cfg /mnt/boot/grub/grub.cfg.copy
sudo chmod +w /mnt/boot/grub/grub.cfg
gksu gedit /mnt/boot/grub/grub.cfg

Note, this is only applicable for WUBI.

Incoming search terms:

  • repair ubuntu upgrade
  • ubuntu wubi repair
  • repair ubuntu
  • fix wubi boot from windows
  • wubi grub cfg
  • repair wubi
  • repair wubi install
  • repair ubuntu wubi
  • squashfs reparieren
  • ubuntu netbook black screen boot

How to Install Fonts in Ubuntu

Here’s a short post about installing fonts in Ubuntu.


sudo cd /usr/share/fonts/
sudo cp ~/Downloads/fonts/* ./
sudo fc-cache -f -v

Take note that ~/Downloads/fonts/ is the directory where my fonts are saved. I just copied it to /usr/share/fonts/ and then refresh the font cache. I hope this helps you as much it helped me.

Incoming search terms:

  • ubuntu netbook install fonts

GCC Install Failure in Ubuntu

When I was trying to install build-essential (for gcc compiler), I keep getting a weird error that says “The HTTP server sent an invalid Content-Range header”. I’ve tried many times as I suspected it’s because of the spotty wifi connection and even tried installing via LAN to no avail. Numerous websites just say retry or use synaptics package manager but all failed. One even suggested that maybe I’m accessing the repository from a Muslim country or from China which of course, is not true and does not have anything to do with my problem. That’s the case until I found this post.

To be clear, here’s the actual problem when I invoke sudo apt-get install build-essential.

After this operation, 14.8MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Err http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main binutils 2.20.1-3ubuntu7
The HTTP server sent an invalid Content-Range header [IP: 91.189.92.170 80]
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/b/binutils/binutils_2.20.1-3ubuntu7_i386.deb The HTTP server sent an invalid Content-Range header [IP: 91.189.92.170 80]

The solution is to remove the files in the following folder.

sudo rm /var/cache/apt/archives/partial/*

After that, I just reinstalled build-essential and everything went fine. I hope this will help you because it did to me. Man, it took me several days. Thanks to Raz.

Incoming search terms:

  • after this operation 14 8mb of additional disk space will be used abort
  • compile a gcc file mysql ubuntu
  • gcc mysql ubuntu
  • gcc on ubuntu mysql
  • ubuntu gcc failed
  • ubuntu gcc install

Ubuntu Netbook Edition 10.10 is not for Netbooks

UNE 10.10 is sooo slow on my Asus eeePC 1002HA! On its current form, 10.10 is just not usable for me. It’s so slow and I need to tinker on settings to make things work. That’s something that put me away from migrating to linux earlier. One example is mounting of my hard disk partition which I don’t need to do in the previous versions.

The Solution?

Stay away from UNE 10.10 and you’ll be fine. Basically, Mark Shuttleworth advises that netbook users stick to Ubuntu Netbook 10.04 LTS for the mean time. That means no Unity Desktop for you, at least for the time being. Fixes are scheduled (I assume) for the Natty Narwhal release — 11.04 which is said to merge Ubuntu Netbook to the desktop edition.

Here’s the relevant Bug Report in launchpad. By the way Mark Shuttleworth is the founder of Canonical, the company maintaining Ubuntu linux distro. I mentioned that because I was surprised that Mark involved in the discussion of this bug.

If you already installed 10.10 (like me!), I suggest you revert it back to 10.04. I have since reinstalled it on my Asus 1002HA and spent a couple of hours more for the updates and software installations. It’s such a shame that I did not check on this issue earlier before upgrading. The bug report has been there since October.

Incoming search terms:

  • netbook met ubuntu netbook edition 10 10
  • ubuntu asus 1002ha
  • ubuntu netbook 10 04 or desktop 10 04 lts for asus eee 1002ha?
  • ubuntu netbook edition lento
  • ubuntu netbook edition netbooks
  • ubuntu netbook slow

Ubuntu Update Broke my Install

This is a bit of a rant rather than a tech note.

As I’ve writtern on my previous post, I initially installed Ubuntu Netbook 10.04 on my ASUS eeePC 1002HA and upgraded it everytime a new version comes out via Ubuntu Software Center(easy and intuitive). So when the last update came out the other week, I just updated the OS. However, I delayed the required restart as I was still doing some important things that time. Everything went fine until I restarted.
[Read more...]

Incoming search terms:

  • eee pc 1002ha install ubuntu
  • how to install ubuntu 10 04 lts on asus eee 1002ha
  • kubuntu update broke dolphin
  • recent update broke ubuntu

Shopping Cart Always Empty

After using suPHP on my Apache webserver and NGINX on another server, I realized that my cart systems are no longer working. Here are the symptoms I noticed.

  1. AJAX Carts does not display items
  2. When clicking checkout, the cart becomes empty
  3. After clicking update, the cart becomes empty

If you look at the symptoms, you’ll notice that every time you move to another page of your website, the cart is emptied. It only mean that the session data is not being saved. And with that, you’ll have to check your PHP save_path session settings in PHP.INI. Most often than not, the current value is /etc/php/sessions. You’ll have to check the folder permission. On my case, the folder is owned by root and the group is apache.
[Read more...]

Incoming search terms:

  • shopping carts always show empty
  • suphp session save_path
  • value session save_path is empty wordpress

Private File Attachments in WordPress

Before WordPress 3.0, I use codes from the plugin Private Files in one of client website to protect the files from illegal download/viewing. It works by not allowing access to WP’s uploads directory and sending and then serving a custom 404 page. It works fine until WordPress 3.0 started sending headers before calling the template’s 404.php. This resulted to the plugin not generating the requested file. After so much googling, I found out that there’s a better way of doing it by using redirect in .htaccess.

Here’s my .htaccess placed on the /wp-content/uploads/ directory.
[Read more...]

Incoming search terms:

  • wordpress private files
  • file attachment wordpress
  • wordpress private downloads
  • private files wordpres
  • wordpress private uploads
  • wordpress private files manage
  • wordpress private files plugin
  • wordpress private file
  • wordpress share private files
  • wordpress plugin files private

NGINX – 502: Bad Gateway

One of my VPS on NordicPVS went down today and after restarting, I got a number of weird errors. Apparently, the contents of my VPS were wiped-out. Though I managed to solve most of the problems (mostly by restoring the backup), I kept getting the 502: Bad Gateway error. I told myself that this can’t happen because I restored the whole system from the backup already.

After going through a checklist, I found out that PHP CGI is not running. All I had to do is jumpstart it and everything is working as before.

/etc/init.d/php_cgi start

[Read more...]

Incoming search terms:

  • nginx bad gateway
  • 502 bad gateway nginx solved
  • 502 bad gateway nginx wordpress
  • nginx 502 bad gateway wordpress
  • wordpress nginx 502
  • phpfog bad gateway nginx
  • virtualmin nginx bad gateway
  • vps 502 bad gateway
  • vtiger nginx bad gateway
  • woirdpress login 502 bad gateway