I'm attempting my first MediaWiki (1.17) install on MacOS X using Macports
for PHP, MySQL and Apache.
https://trac.macports.org/wiki/howto/MAMP
My intent is to use a wiki documenting personal projects, and placed it in
~/Sites/mediawiki. My LocalSettings.php file contains the definition below.
$wgScriptPath = "/~bpabbott/mediawiki";
The absolute path is /Users/bpabbott/Sites/mediawiki
Everything appeared to be ok, until I tried to enable LaTeX to be used to
render equations. I made the changes below to my LocalSettings.php.
$wgEnableUploads = true;
## Upload paths. May want other Directories for additional wikis
$wgUploadPath = "$wgScriptPath/images";
$wgUploadDirectory = "$wgScriptPath/images";
## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
$wgUseTeX = true;
## Setup the Math directories
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
To help with debugging, I also did the unwise thing below.
mkdir ~/Sites/mediawiki/images/math
mkdir ~/Sites/mediawiki/images/tmp
$ chmod 777 ~/Sites/mediawiki/images/math
$ chmod 777 ~/Sites/mediawiki/images/tmp
Even with no security, when I attempt to include an equation on a page, I
encounter the error below (while in preview)
WARNING: wfMkdirParents: failed to mkdir "/~bpabbott/mediawiki/images/tmp"
modes 511 in /Users/bpabbott/Sites/mediawiki/includes/GlobalFunctions.php on
line 2324.
The wfMakeParents function in my GlobalFunctions.php, is below.
2292 /**
2293 * Make directory, and make all parent directories if they don't exist
2294 *
2295 * @param $dir String: full path to directory to create
2296 * @param $mode Integer: chmod value to use, default is
$wgDirectoryMode
2297 * @param $caller String: optional caller param for debugging.
2298 * @return bool
2299 */
2300 function wfMkdirParents( $dir, $mode = null, $caller = null ) {
2301 global $wgDirectoryMode;
2302
2303 if ( !is_null( $caller ) ) {
2304 wfDebug( "$caller: called wfMkdirParents($dir)" );
2305 }
2306
2307 if( strval( $dir ) === || file_exists( $dir ) ) {
2308 return true;
2309 }
2310
2311 $dir = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $dir
);
2312
2313 if ( is_null( $mode ) ) {
2314 $mode = $wgDirectoryMode;
2315 }
2316
2317 // Turn off the normal warning, we're doing our own below
2318 wfSuppressWarnings();
2319 $ok = mkdir( $dir, $mode, true ); // PHP5 <3
2320 wfRestoreWarnings();
2321
2322 if( !$ok ) {
2323 // PHP doesn't report the path in its warning message, so add our
own to aid in diagnosis.
2324 trigger_error( __FUNCTION__ . ": failed to mkdir \"$dir\" mode
$mode", E_USER_WARNING );
2325 }
2326 return $ok;
2327 }
It appears that PHP is not able to make sense of "/~bpabbott" ... which
Mediawiki interprets as "/Users/bpabbott/Sites" (?) ... I tried using an
absolute path for $wgScriptPath, but that breaks the wiki.
Any ideas?
--
View this message in context:
http://wikimedia.7.n6.nabble.com/math-results-in-wfMkdirParents-failed-to-m…
Sent from the English Wikipedia mailing list archive at
Nabble.com.