Posts Tagged CLI

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

Resetting Windows product activation notices

WARNING: Please read before continuing ▼

Difficulty: Easy
Time: ~1 Minute
Last Updated: 5th November 2009
Applies to: Windows

Since Windows XP, Microsoft has required that all CD keys are validated with them at install time, to combat piracy. Whilst this generally has little impact, if you have misplaced your CD key, or are waiting for one to arrive, you can end up locked out of your own computer.
Read the rest of this entry »

, , , ,

No Comments

Utilities: Filename Randomiser

Program Information:

This is a small program to change the filenames of all files in the target folder to something random and uniform. This may be useful for, as an example, a number of photos in a directory that are displayed in filename order.

It should go without saying that if you run this on a directory it will rename everything in that directory, so take care.

Read the rest of this entry »

, , , ,

No Comments

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