Archive for the ‘php’ Category

MySQL Cannot Connect with PHP in OSX

Wednesday, March 14th, 2007

I think some of you might have problem connecting to MySQL with PHP(mysql_connect) in Max OS X if you configured MySQL5 with Darwin Ports. Most probably you will get these error message;

Warning: mysql_connect() [function.mysql-connect]: Can’t connect to local MySQL server through socket ‘/opt/local/var/run/mysql5/mysqld.sock’ (13) in /Users/paulooicongjen/myproject/web/info.php on line 10
Could not connect: Can’t connect to local MySQL server through socket ‘/opt/local/var/run/mysql5/mysqld.sock’ (13)

The error message is caused by the folder mode created by MySQL installation by default. To solve this problem, change your folder mode to 755 and restart apache.

cd /opt/local/var/run
sudo chmod 755 mysql5
sudo apachectl restart

It should works now!

TextMate: Creating New Project in Shell Instantly

Tuesday, March 13th, 2007

Been using TextMate recently, really loving it like hell. There is a best part of TextMate that you can create a New Project instantly from your www folder. But first and foremost you got to create symlink to /bin.

To create a symlink, do this

sudo ln -s /Applications/TextMate.app/Contents/Resources/mate /bin/mate

After you have created the symlink, change directory to your www folder for example

cd /opt/local/apache/htdocs/myproject

And run the command mate .

mate .

Congrat, new project has been created with Text Mate, just save it with shortcut key Ctrl + Command + S

Yeha! PHP 5.2.0!

Friday, November 3rd, 2006

PHP 5.2.0 released! Some on the features I like.

The key features of PHP 5.2.0 include:

  • New memory manager for the Zend Engine with improved performance and a more accurate memory usage tracking.
  • Input filtering extension was added and enabled by default.
  • JSON extension was added and enabled by default.
  • ZIP extension for creating and editing zip files was introduced.
  • Hooks for tracking file upload progress were introduced.
  • Introduced E_RECOVERABLE_ERROR error mode.
  • Introduced DateTime and DateTimeZone objects with methods to manipulate date/time information.
  • Upgraded bundled SQLite, PCRE libraries.
  • Upgraded OpenSSL, MySQL and PostgreSQL client libraries for Windows installations.
  • Many performance improvements.
  • Over 200 bug fixes.

Security Enhancements and Fixes in PHP 5.2.0:

  • Made PostgreSQL escaping functions in PostgreSQL and PDO extension keep track of character set encoding whenever possible.
  • Added allow_url_include, set to Off by default to disallow use of URLs for include and require.
  • Disable realpath cache when open_basedir and safe_mode are being used.
  • Improved safe_mode enforcement for error_log() function.
  • Fixed a possible buffer overflow in the underlying code responsible for htmlspecialchars() and htmlentities() functions.
  • Added missing safe_mode and open_basedir checks for the cURL extension.
  • Fixed overflow is str_repeat() & wordwrap() functions on 64bit machines.
  • Fixed handling of long paths inside the tempnam() function.
  • Fixed safe_mode/open_basedir checks for session.save_path, allowing them to account for extra parameters.
  • Fixed ini setting overload in the ini_restore() function.

PHP Recode Caused PHP Core Dump?

Thursday, November 2nd, 2006


php -v
PHP 5.1.6 with Suhosin-Patch 0.9.6 (cli) (built: Nov 1 2006 11:37:21)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
php in free(): error: junk pointer, too high to make sense
Abort (core dumped)

After this


pkg_deinstall recode

No more core dump, record has bugs?

FreeBSD Ports PHP with Suhosin

Thursday, November 2nd, 2006

Just found out FreeBSD Ports ported Suhosin. When you install php from port, you can either choose configure with Suhosin or no.


PHP 5.1.6 with Suhosin-Patch 0.9.6 (cli) (built: Nov 1 2006 11:37:21)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies