Posts Tagged OS-X

Installing the ssh2 PHP extension, with PHP 5.3

WARNING: Please read before continuing ▼

Difficulty: Moderate
Time: ~5 Minutes
Last Updated: 21st March 2010
Applies to: *NIX

Currently, due to an API change ssh2 will not install via pecl. Despite being a one-line fix, and 5.3 being out for some months now, the maintainers have neglected to make their extension compatible with PHP 5.3

If you recieve an error similar to:

1
2
/tmp/pear/download/ssh2-0.11.0/ssh2.c:52: error: duplicate "static"
/tmp/pear/download/ssh2-0.11.0/ssh2.c: In function "zif_ssh2_methods_negotiated":

Then you are affected. To fix this, you need to download and extract the ssh2 package:

1
2
pecl download channel://pecl.php.net/ssh2-<version>
tar xvf ssh-<version>.tar

Open up ssh2-<version>/ssh2.c and look for the following block around line 50:

1
2
3
4
5
6
7
8
#ifdef ZEND_ENGINE_2
static
    ZEND_BEGIN_ARG_INFO(php_ssh2_first_arg_force_ref, 0)
        ZEND_ARG_PASS_INFO(1)
    ZEND_END_ARG_INFO()
#else
static unsigned char php_ssh2_first_arg_force_ref[] = { 1, BYREF_FORCE };
#endif

From that block, you need to remove the first “static” so it looks like this:

1
2
3
4
5
6
7
#ifdef ZEND_ENGINE_2
    ZEND_BEGIN_ARG_INFO(php_ssh2_first_arg_force_ref, 0)
        ZEND_ARG_PASS_INFO(1)
    ZEND_END_ARG_INFO()
#else
static unsigned char php_ssh2_first_arg_force_ref[] = { 1, BYREF_FORCE };
#endif

After you’ve done this, simply repackage and install:

1
2
pecl package package.xml
pecl install -f ssh2-<version>.tgz

, , , , , , , , ,

No Comments

Opening an elevated command prompt

WARNING: Please read before continuing ▼

Difficulty: Easy
Time: varies
Last Updated: 29th November 2009
Applies to: OS X, Windows, *NIX

Often when performing system administration, you will come across a command that needs to be run as a more priviliged user. Depending on what operating system you use, the procedure for opening an elevated command prompt varies. Read the rest of this entry »

, , , , , , , ,

No Comments

Comparing the contents of 2 directories

WARNING: Please read before continuing ▼

Difficulty: Easy
Time: Varies
Last Updated: 9th November 2009
Applies to: OS X, and Linux

Sometimes, you can end up with multiple copies of a directory from different times. If the number of files is small, then comparing the contents is easy. With large directories, telling the difference between them can be nearly impossible.

Read the rest of this entry »

, , , ,

No Comments

Clearing cached DNS entries

WARNING: Please read before continuing ▼

Difficulty: Expert
Time: ~1 Minute
Last Updated: 1st November 2009
Applies to: Windows, OS X, and Linux

Sometimes, when messing around with domain names (the DNS system), you’ll mis-type an address, and be unable to access your site for a significant length of time. Assuming that the incorrect entry has not been cached on another DNS server somewhere between you and your host, you can clear the list of cached addresses on your own machine to resolve the problem.

Read the rest of this entry »

, , , , , , ,

No Comments

Remotely controlling OS-X via a web page

WARNING: Please read before continuing ▼

Difficulty: Expert
Time: varies
Last Updated: 24th October 2009
Applies to: OS X

Applescript is a scripting language provided by OS X that has the ability to automate significant portions of the system.

PHP has the ability to, given the right configuration, make arbitrary system calls, including applescript.

Using the two together, one can remotely control a number of functions on an OS X system via a web page.

Read the rest of this entry »

, , , , ,

No Comments

Mixing C++ and Objective-C code using XCode

WARNING: Please read before continuing ▼

Difficulty: Expert
Time: varies
Last Updated: 20th October 2009
Applies to: Objective-C

With the release of the iPhone SDK and the growing popularity of OS X, Objective-C is becoming the language of choice for a significant amount of projects.

One inescapable fact in the programming world is the existence of legacy code. Moving to a new language typically means porting or rewriting existing code entirely in the new language. In the case of Objective-C, most existing C and C++ code can be used directly.

Read the rest of this entry »

, , , , , ,

No Comments

Deploying a KIWI CD/DVD image created with KIWI to a USB drive

WARNING: Please read before continuing ▼

Difficulty: Moderate
Time: ~30 Minutes
Last Updated: 26th September 2009
Applies to: *NIX

KIWI is a new tool released by the people behind OpenSUSE for creating customised distributions. One of the best features of it is that the images created are portable. However, documentation is scant at this time, and the instructions for deploying an ISO image onto a USB device are buried deep in the manual.

The actual process for copying the file is simple, however, identifying the right drive can be tricky.

Read the rest of this entry »

, , , , , , , ,

No Comments

Technical Procedures is Digg proof thanks to caching by WP Super Cache