PHP JSON Module Bug Fix

If you are encountering any weird stuff with your PHP-JSON module installation, you might want to reinstall JSON using this link, this might get rid of the bug that is pestering you and your application.

First, uninstall any previous JSON installation you have so as not to conflict with the new one. To make sure you got the old JSON out, check your list of PHP modules by running:

php -m

JSON should not be listed and make sure you do not see any errors either. Doing this will prevent further headaches, trust me.

Perform the following steps to install the bug-free version of JSON from source:

1. Download the JSON source from here. You can use wget to download the source if you are using CLI

wget http://aurore.net/projects/php-json/php-json-ext-1.2.1.tar.bz2

2. Uncompress the archive and change directory.

tar jxf php-json-ext-1.2.1.tar.bz2
cd php-json-ext-1.2.1

3. Run phpize. Make sure that phpize is installed before proceeding to this step. phpize is included in the php-devel package.

phpize

4. Configure, make and make install

./configure
make
make install

JSON is now installed, but make sure that json.so is loaded in your php.ini file.

1. Open php.ini file. If you are unsure about the location of your php.ini file, run

php -i | grep php.ini

You should see something like this:

Loaded Configuration File => /etc/php.ini

2. Add this at the last line of the configuration file:

extension=json.so

3. You might want to restart Apache to make sure everything is still working.

To check if JSON is loaded as module, run php -m again, make sure JSON is in the list.

Now, to test JSON, open an editor and copy these lines:

< ?php
$input = '{ "test" : 12121211212121 }';
$val = json_decode($input, true);
print $val["test"];
?>

Save the file (json-test.php is the filename in this case).

Execute the file by running php json-test.php

The result should be 12121211212121

Popularity: 3% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl
hackersbook support space

How To Reset MySQL Password

If you are like me who tend to forget passwords almost every time, then this tip might help you reset your MySQL password just in case.

To begin, you must have access to the server, one that can stop and start the MySQL process, such as a root account. Sudo account can also be used, just as long that the user can control the MySQL service.

Begin the process by stopping the MySQL process. This can be done by executing /etc/init.d/mysqld stop command, but this can vary depending on how you setup your server. Also, be careful of users who might be using the MySQL service as stopping the service might disrupt their work.

Once the MySQL process is killed, execute the following command:

mysqld-safe --skip-grant-tables

This will run the MySQL process so you need to open another terminal to be able to reset the password. On the new terminal, you will now be able to login to MySQL to reset the password.

On the shell prompt of the new terminal, open the MySQL console:

mysql

mysql> use mysql;
mysql> UPDATE user SET Password=PASSWORD(‘YOUR_NEW_PASSWORD’) WHERE Host=’localhost’ AND User=’root’;
mysql> exit

This will change the password for the user ‘root’. Kill the MySQL process running in the first terminal, either by killing the PID or executing CTRL+C. Then start the process again, this time with the proper procedure:

/etc/init.d/mysqld start

Try logging in to the MySQL console using the new password:

mysql –uroot -p

You should now be able to use the new password for your MySQL.

Popularity: 4% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

Fix Fatal error: Allowed memory size of 8388608 bytes exhausted

I was installing xdebug a few days back to one of the production servers when I encountered this beautiful error message:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 143 bytes) in /usr/share/pear/PEAR/PackageFile/v2/Validator.php on line 1608 Allowed memory size of 8388608 bytes exhausted (tried to allocate 64 bytes)

So my instinct tells me to look inside the php.ini file and find for this line:

memory_limit = 12M

The server’s php.ini file is already set to 256M so I should go look for something else. Luckily, I found this tip from www.agileapproach.com.

Open the file /usr/share/pear/pearcmd.php and add this right after the < ?php line:

@ini_set('memory_limit', '16M');

That should fix the “Fatal error: Allowed memory size” error. I can now resume installing xdebug without any errors.

The reason why editing the php.ini will not fix the issue is because PECL/PEAR does not use the PHP settings, so the PEAR settings needs to be adjusted.

Hope this helps.

Popularity: 4% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

PinoyTux Visitors Reach 90k

It’s been quite a while since I updated my blog, life keeps getting in the way. It was only today that I noticed that my visits has already reached more than 90,000 visitors. It is not much for most professional bloggers and SEO specialists, but for me it’s a milestone. For a blog that rarely gets updated, it is a surprise to know that people even read my blog. :)

Popularity: 6% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

Capture Time To First Byte using curl

Working with websites is equivalent to non-ending website testing. Checking the speed of the site itself is not a new thing to check when doing performance diagnostics. And I found out that curl can calculate the speed of a website, from the initial connection time, to the time the first byte is downloaded, up to the total time the site has finished loading.

Here is a sample command using curl:

curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" http://inserturl.here

This command will output this:


[root@rai01 ~]# curl -o /dev/null -w “Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n” http://pinoytux.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 –:–:– 0:00:01 –:–:– 0
Connect: 0.268 TTFB: 1.528 Total time: 1.528

Looks like my website is fast :)

The first data is the Connect time, which means this is how long it took for the curl to connect to the website.
Connect: 0.268

The second data is time when the first byte was received, Time To First Byte (TTFB).
TTFB: 1.528

The last data is the total time for the site to finish loading.
Total time: 1.528

You can also turn off the progress bar by adding the -s switch to the command.

From: http://www.unquietdesperation.com/2009/03/19/time-to-first-byte-with-curl/

Popularity: 13% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

Google Maps for Sony Ericsson W850i

My Sony Ericsson W850i phone is getting older by the minute. And now that I am so in love with traveling and going to different places, somehow I thought of buying a new GPS device, or a GPS-enabled phone, whichever is cheaper.

So I went Googling around and found out that there is no need to buy a separate device for GPS. My phone CAN be GPS device! Talk about the power of technology, specifically Java.

Google Maps for Mobile is free and available to all users who have colored Blackberry devices and some Java-enabled phones. I tried this on my W850i and it is working! My golly!

Take note that standard charges for Internet browsing apply since the app connects to Internet. Small price to pay for a handy GPS when you are lost in the middle of nowhere.

Okay, enough chit-chat. Here’s the download link:

http://www.getjar.com/products/15897/GoogleMapsformobilefeaturingLatitude

Tried this on your phone? Post your feedback.

Popularity: 14% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

Tips: SSL Certificate Checker

If you have one too many SSL certificates to manage, there is one nifty program made with Bash that can determine a certificate’s validity.

SSL Certificate Expiration Check can do that for you and send the results to email. The program’s “send to email” feature allows the user to simply add it to cron to check the certificates and send an alert to the administrator if any certificate (from file or website) falls below the set expiration date.

The source can be downloaded here.

Popularity: 13% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

Register.com Nameservers Suffered DOS Attacks

Infosec.org News reports that Register.com suffered yet another DDOS attack last April 2 that has a wide-scale effect on its critical operations. Nameservers are down so not one domain that uses Register.com’s nameservers can be resolved, resulting to downtime and to most customers, loss of income. Even the domain registrar’s official website cannot be accessed during the time of the attacks.

I managed to get through their clogged phone lines and the customer service representative assured that their engineers are working hard to bring the servers back to operation.

Hopefully after this unfortunate event, which surely cost them valuable customers, has taught them to be more pro-active against potential attacks to their networks.

Update:

Register.com formed an official announcement regarding their service disruption during the DDOS attacks on their network infrastructure. Here is the official statement:

Register.com Service Alert
April 4, 2009: 2:52PM EST

As we previously communicated, Register.com has been experiencing intermittent service disruptions as a result of a distributed denial of service (DDoS) attack.

We want to update you on where things stand.

As of now, all web services are operational. If you are experiencing any issues please call 1-888-734-4783. We have support teams standing by to respond immediately.

Please note we are not discounting the possibility of an escalated DDoS attack. We are taking every possible precaution to protect our infrastructure and our customers. In response we have:

* Deployed counter-measures to mitigate the attack and added capacity across the company’s network
* Setup special channels with major ISPs to re-enable customers’ services
* Isolated the profile of the attack through forensic data analysis
* Engaged the FBI and The Department of Homeland Security

We promise to update you if there is any change to the situation.

Throughout this attack we have received incredible support from our customers and want to thank you for your understanding and continued loyalty. We recognize these attacks create significant hardships for our customers and will continue to work to maintain and earn your trust.

Popularity: 12% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

Earth Hour 2009

I encourage everyone to join Earth Hour this coming March 28, 2009. As a symbol of our devotion to protect Mother Earth, let us turn off our unessential lights and appliances to reduce power consumption and carbon emissions for 1 hour.

Earth Hour will start at 8:30 PM localtime. This means wherever you are, Earth Hour will commence at your city’s localtime.

Popularity: 13% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl

10 Reasons Why Linux will Triumph over Windows

Please, everyone settle down. I am not starting a flame thread here but I would like you to read these ten reasons why Linux will stomp over Windows’s head. TechRepublic writes:

I have an announcement. The error of Microsoft’s ways is finally catching up and will cause the once-invincible juggernaut to kneel before that which is Linux. How is this? Microsoft started a tiny snowball when it released Windows Me. That snowball did nothing but gain momentum. There have been ups and downs along the way (XP being an up, for sure). But for the most part, the court of public opinion has steady lost faith in what once was considered the heart of personal computing.

If you don’t believe me, read on.

1. Inconsistent Windows releases

One of the things you can always count on from Microsoft is that you can’t count on its new operating systems to be reliable. Let’s take a look at the individual releases:

* Windows 95: Revolutionized personal computing.
* Windows 98: Attempted to improve on Windows 95; failed miserably.
* Windows Me: A joke, plain and simple.
* Windows NT: Attempted to bring enterprise-level seriousness to the operating system; would have succeeded had it not taken Steven Hawking-like intelligence to get it working.
* Windows XP: Brought life back to the failing Windows operating system. It hadn’t been since Windows 95 that the operating system was this simple.
* Windows Vista: See Windows Me.

With this in mind, what do we expect from Windows 7? Myself, not much.

2. Consistent Linux releases

Converse to number 1, you have the far more consistent releases of the various Linux distributions. Yes, there have been a few dips along the way (Fedora 9 being one of them). But for the most part, the climb for Linux has been steadily upward. Nearly every Linux distribution has improved with age. And this improvement isn’t limited to the kernel. Look at how desktops, end-user software, servers, security, admin tools, etc., have all improved over time. Once could easily argue that KDE 4 is an example of a sharp decrease in improvement. However, if you look at how quickly KDE 4 has improved from 4.0 to 4.3 you can see nothing but gains. This holds true with applications and systems across the board with Linux.

Read the rest of this entry »

Popularity: 21% [?]

Share and Enjoy:
  • E-mail this story to a friend!
  • StumbleUpon
  • Digg
  • Technorati
  • del.icio.us
  • Reddit
  • Facebook
  • Google
  • Slashdot
  • Blogosphere News
  • TwitThis
  • NewsVine
  • Propeller
  • Furl
  • Simpy
  • Spurl