After upgrading my PHP to 5.3.2, I received the following error when accessing MediaWiki (1.6.12):

Parse error: syntax error, unexpected T_NAMESPACE, expecting T_STRING in /usr/local/www/apache22/data/wiki/includes/Namespace.php  on line 46

There are three solutions:

  1. Downgrade your PHP from 5.3 back to 5.2
  2. Upgrade your MediaWiki to a newer version.
  3. Fix the codes.

In my case, the first couple solutions do not work for me, and therefore I choose 3.

  1. Backup your wiki file first.
  2. Access your webserver and go to the MediaWiki/includes directory.
    For example:

    cd /usr/local/www/apache22/data/wiki/includes
  3. Edit Namespace.php
    nano Namespace.php
  4. Go to line 46, change the following from:
    class Namespace {

    to:

    class MWNamespace {

    Save the file.

  5. Now, let’s create a script:
    nano wikifix.sh

    Copy and paste the following:

    for fl in *.php; do
    mv $fl $fl.old
    sed 's/Namespace::/MWNamespace::/g' $fl.old > $fl
    done

    Save the file.

  6. Change the file to executable by:
    chmod u+x wikifix.sh
  7. Search the keyword Namespace:: and replace it by MWNamespace:::
    ./wikifix.sh

    Warning: Don’t run the script twice!

  8. Delete the script.
    rm wikifix.sh

Try to access the MediaWiki again and the problem should be gone.

Enjoy Wiki.

–Derrick

Our sponsors:

I have a 30GB iPod and I am always running out of space. Recently I found that iTune 9.1.079 comes with a new feature. This features simply converts high quality music file to standard quality music. By doing this, which results in decreasing the file size and free up the space for other music.

To enable this feature, simply open your iTune –> iPod –> Summary tab –> Options section –> Check the option: “Convert higher bit rate songs to 128 kbps AAC”

Click below to enlarge the screenshot:

How to save space on your iPod?

How to save space on your iPod?

Before I enabled this option, there were only 2GB left on my iPod. Now I have 16.41GB free space, which is 8 times more than before!

Our sponsors:

Today I imported the MySQL database and I got the following error:

# mysql -u root -p db_test < test.db
Enter password:
ERROR 2006 (HY000) at line XX: MySQL server has gone away

It is because the data (SQL query) is too large to imported. To solve this problem, simply edit the MySQL configuration files: /etc/my.cnf

Replace the following from:

max_allowed_packet = 1M

To:

max_allowed_packet = 16M

Or something higher.

Restart the MySQL server again and the problem will be gone.

/usr/local/share/mysql/mysql.server restart

--Derrick

Our sponsors:

After trying the Opera Mini for iPhone, here is my comment:

  1. Zoom is missing. You can’t use finger to zoom in/out the page. It makes it very hard to browse the full-size page from the phone.
  2. Poor support on JavaScript. Website that works fine on Safari doesn’t mean they will do fine on Opera Mini.
  3. Lack of support. Many iPhone-friendly websites do not support Opera mini.

Suggested headline news for Opera.com:

  • There are over million of download of Opera Mini in 2 hours.

Suggested headline for Apple.com:

  • Safari is still the best iPhone browser on the planet.
  • 80% of the iPhone users remove the Opera Mini within 5 minutes.
  • Since Opera Mini cannot do the zoom and render JavaScript correctly, it should be recalled and removed from the iPhone App store.

Suggested response to Opera:

  • Opera Mini is still the 2nd best (and 2nd most popular) browser for iPhone on the planet.
  • (Keep in mind that  there are only two browsers for iPhone…)

Our sponsors:

This article is a bit outdated. Please visit the following article instead. It includes a better discussion on how to solve this problem using different scenarios:

Thanks.

–Derrick

Our sponsors:

Today I upgraded the port on my FreeBSD box using portmaster tools:

portmaster -Dai

After that, I found that the PHP gave the following weird error:

php -v

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20060613/memcached.so' - /usr/local/lib/php/20060613/memcached.so: Undefined symbol " php_session_create_id" in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20060613/mysql.so' - Cannot open "/usr/local/lib/php/20060613/mysql.so" in Unknown on line 0

PHP 5.2.12 with Suhosin-Patch 0.9.7 (cli) (built: Apr  6 2010 15:50:36)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

In order to solve this problem, you will need to rebuild the port. In my situation, I need to clean up, uninstall, rebuild and install the affected ports:

Memcached: /usr/ports/databases/pecl-memcached

MySQL: /usr/ports/databases/php5-mysql

——————————————————————————————
Update on 2010.04.13:
Your situation may be different from mine. The tricky part is to rebuild the port at the right location. For example, if your PHP complains about pdo.so, you can rebuild the port at the affected location:

/usr/ports/database/php5-pdo

If you are not sure where does the port locate, you can search it on Google or find it with the following command:

find /usr/ports/ -name "*pdo*"

——————————————————————————————

In each affected port, run the following commands:

make clean
make deinstall
make
make install && sync
make clean

After that, restart the PHP by restarting Apache:

sudo apachectl restart

and run the php command again:

php -v

The error should be gone:

PHP 5.2.12 with Suhosin-Patch 0.9.7 (cli) (built: Apr  6 2010 15:50:36)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

Our sponsors: