Topic on Extension talk:SyntaxHighlight

Requirements for SyntaxHighLight and other extensions

2
Harm.frielink (talkcontribs)

The extension SyntaxHighLight uses the access to shell of the Webserver it is running on.

Most hosting provider do not give the user access to the shell.

The code of SyntaxHighLight uses the MediaWiki Class Shell which checks if the user has access to the proc_open. See:

/**
* Checks if this class is effectively disabled via php.ini config.
*
* @return bool disabled
*/
public static function isDisabled() {
  static $disabled = null;

  if ( is_null( $disabled ) ) {
    if ( ! function_exists( 'proc_open' ) ) {
      wfDebug( "proc_open() is disabled\n" );
      $disabled = true;
    } else {
      $disabled = false;
    }
  }
  return $disabled;
}

There seems not to be another solution available.

My advice to not use the shell for extensions. It won't work.


The other remark is to make a requirements chapter for every extension which gives the user this information BEFORE he is trying to use such an extension!

This requirement chapter can explain which functions and which languages are needed.

There are a number of PHP functions that are disabled in the php.ini by the hosting providers. Examples are disk_total_space, diskfreespace, exec, system, popen, proc_open, proc_nice, shell_exec, passthru, dl

Check your php.ini file or create a website with the function phpinfo();


I would also suggest to use PHP as de-facto without the need to use other languages.

Jdforrester (WMF) (talkcontribs)

My advice to not use the shell for extensions. It won't work.

In the other direction, our advice is not to use hosting providers that don't give you shell access, as it won't work for lots of functionality.

That said, I've added a note reminding sysadmins of this.

Reply to "Requirements for SyntaxHighLight and other extensions"