Topic on Extension talk:Scribunto

The content model 'sanitized-css' is not registered on this wiki.

13
Nicolas senechal (talkcontribs)

I try to import the notice tamplate from Wikipedia, I work on xampp on windows. So I install scribunto and lua on my wiki and when I went to import notice I have this error(I did a little translation from French to English) :

import error : The content model 'sanitized-css' is not registered on this wiki

So I have my template but no Css and documentation don't work.

maybe it's a lua error, in that case it's an installation error (because I don't quite understand the full installation on windows so I have a lua dll in my php...)

Any help is appreciated.

Dylsss (talkcontribs)
Nicolas senechal (talkcontribs)

Thank you @Dylsss it works well, now I have a lua error.

Erreur de script : Erreur Lua : erreur interne : l’interpréteur s’est arrêté avec l’état « 1 »

translate :

script error : lua error : intern error : the interpreter stop with stat «1»

So if someone can give me a good doc to download lua on XAMPP on windows I take. Because I think just to put the dll is not enough...

FeRDNYC (talkcontribs)

@Nicolas senechal: If you're trying to use luaSandbox, check my comments in this discussion for information about setting it up. I imagine that process should be almost the same for xampp as for IIS, since you're installing Lua into PHP as an extension.

FeRDNYC (talkcontribs)

Also, make sure you installed a Lua 5.1 DLL — newer versions are NOT compatible.

Nicolas senechal (talkcontribs)

Thank you, I don’t quite understand this technical part ‘or in the directory above it where the PHP binary lives.’ I dosen't find the php binary location… and scribunto don’t find the path to lua so I set this:

wfLoadExtension( 'Scribunto' );

$wgScribuntoEngineConf['luasandbox']['luaPath'] = 'C:\xampp\php\ext\php_luasandbox.dll';

$wgScribuntoDefaultEngine = 'luasandbox';

And in the import page when I went to import I have this error :

import failure : The luasandbox extension is not present, this engine cannot be used.

It doesn't work (maybe because of my bad?)

FeRDNYC (talkcontribs)

By "the directory above it where the PHP binary lives" I simply meant the directory C:\Program Files\PHP\v8.0\, the parent directory of the extension folder C:\Program Files\PHP\v8.0\ext\. Since one of the default load paths for DLLs is the same directory as the executable file loading them, and since the actual php.exe binary is located in that directory (the parent), it seemed like a good idea to place the lua DLL in there as well. (But I also dropped it into the extension directory, so I was covered either way.)

I think what you're missing is to have PHP itself load the luasandbox extension. You need to add a line to your php.exe file php.ini file telling it to load the extension:

extension=php_luasandbox.dll

That'll tell PHP to load the file php_luasandbox.dll, which you should've placed in your PHP installation's ext directory.

FeRDNYC (talkcontribs)

You need to add a line to your php.exe file

Sorry, I meant php.ini file.

FeRDNYC (talkcontribs)

@Nicolas senechal: Also, you definitely don't want this line:

$wgScribuntoEngineConf['luasandbox']['luaPath'] = 'C:\xampp\php\ext\php_luasandbox.dll';

I mean, I don't think it'll do any harm, but at best it's a useless statement that will be ignored, at worst it might cause some sort of actual problem. The sandboxed interpreter extension has to be loaded by php.exe at startup, which is why it's installed by editing php.ini instead of the MediaWiki configuration.

FeRDNYC (talkcontribs)

(If anything, I think you'd want to set luaPath to the location of lua5.1.dll, instead — but that shouldn't be necessary. It'll work without any configs as long as the php_luasandbox.dll module can find the interpreter, and if it can't then setting the path in the MediaWiki configuration is unlikely to solve the problem.)

Nicolas senechal (talkcontribs)

Thank you very much , so I have lua5.1.dll at ext and in it parent directory(it was my last configuration...) I have luasandbox.dll in ext and I put in php.ini line (I did it again in the past...) but I try to launch ph.exe and I know the problem now but not the solution.

PHP Warning:  PHP Startup: Unable to load dynamic library 'php_luasandbox.dll' (tried: C:\xampp\php\ext\php_luasandbox.dll (Le module sp├®cifi├® est introuvable), C:\xampp\php\ext\php_php_luasandbox.dll.dll (Le module sp├®cifi├® est introuvable)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'php_luasandbox.dll' (tried: C:\xampp\php\ext\php_luasandbox.dll (Le module sp├®cifi├® est introuvable), C:\xampp\php\ext\php_php_luasandbox.dll.dll (Le module sp├®cifi├® est introuvable)) in Unknown on line 0


He can't find cifi module, what is it, how can make it find?

FeRDNYC (talkcontribs)

Hmm, I'm not sure — that's an error I haven't personally hit, to be honest. I also can't seem to find any information about a "cifi" module on the internet... is that error message a direct cut-and-paste, or did you retype it? Is it possible it was the 'cffi' module that was referenced? (That one, at least, I have heard of.)

It sounds to me like you might not have all of the pieces of the lua extension installed, or you might have the wrong luaSandbox extension installed. My reading online is that the Apache version of PHP (which I assume is what's used in XAMPP) uses thread-safe extensions, unlike the versions installed for IIS which use non-thread-safe.

The only time I've seen a message anything like the one you provided is when I didn't have lua5.1.dll installed in the correct location. (I've now conclusively determined that it must be installed in the same directory as php.exe, not the extension directory. So, in your setup, it should be located at C:\xampp\php\lua5.1.dll.) Otherwise, with my PHP installation, starting PHP with the extension enabled will output this similar error message:

> C:\tools\php81\php.exe -a
PHP Warning:  PHP Startup: Unable to load dynamic library 'luasandbox' (tried: ext\luasandbox (The specified module could not be found), ext\php_luasandbox.dll (The specified module could not be found)) in Unknown on line 0
Interactive shell

php >

Once I copied lua5.1.dll to C:\tools\php81\lua5.1.dll, that error message went away and I was able to use the example code provided here to test the Lua sandbox implementation without even involving MediaWiki (until I knew it was working).

Nicolas senechal (talkcontribs)

Thank you very much for your patient and for your help. The problem is a copy past, so maybe a bad translates of php because cifi is not a frensh word. So it can be possible it's cffi.

Now I am in thread-safe dll.

I try to put lua5.1 in the parent file and it doesn’t work.

I shear in phpinfo if don't miss something and I find an old reference in PHP Variables $_SERVER['PATH'] and in the environment Path I have this path C:\Program Files (x86)\WinLua\Lua\5.3\bin\; I uninstall winlua and it is still in the php configuration, so I uninstall xampp and install it again. The line still here... maybe here we have the error so how can I really unstall it?

I have already an error, I remove lua5.1 from C:\xampp\php and I don't have an error in php.exe. And when lua5.A is in C:\xampp\php I have the same result.

SO my actualle configuration it'sphp 8.1.2 I have the line extension=php_luasandbox.dll in php.ini , I have C:\xampp\php\ext\php_luasandbox.dll and C:\xampp\php\lua5.1.dll

I try the example code (I don't think it's coding errors) but I have this error.

Fatal error: Uncaught Error: Class "LuaSandbox" not found in C:\xampp\htdocs\mediaWikiTest\infoPHP.php:8 Stack trace: #0 {main} thrown in C:\xampp\htdocs\mediaWikiTest\infoPHP.php on line 8

contenue de infoPhp.php

<?php //GET info php

echo "pcre: " . ( extension_loaded( "pcre" ) ? PCRE_VERSION : "no" ) . "\n";

echo "pcntl: " . ( extension_loaded( "pcntl" ) ? "yes" : "no" ) . "\n";

echo "mbstring: " . ( extension_loaded( "mbstring" ) ? "yes" : "no" ) . "\n";

phpinfo();

echo "=============================luaTest==============================\n";//code from https://www.php.net/manual/en/luasandbox.examples-basic.php

$sandbox = new LuaSandbox;

$sandbox->setMemoryLimit( 50 * 1024 * 1024 );

$sandbox->setCPULimit( 10 );

// Register some functions in the Lua environment

function frobnosticate( $v ) {

    return [ $v + 42 ];

}

$sandbox->registerLibrary( 'php', [

    'frobnosticate' => 'frobnosticate',

    'output' => function ( $string ) {

        echo "$string\n";

    },

    'error' => function () {

        throw new LuaSandboxRuntimeError( "Something is wrong" );

    }

] );

// Execute some Lua code, including callbacks into PHP and into Lua

$luaCode = <<<EOF

php.output( "Hello, world" );

return "Hi", function ( v )

    return php.frobnosticate( v + 200 )

end

EOF;

list( $hi, $frob ) = $sandbox->loadString( $luaCode )->call();

assert( $frob->call( 4000 ) === [ 4242 ] );

// PHP-thrown LuaSandboxRuntimeError exceptions can be caught inside Lua

list( $ok, $message ) = $sandbox->loadString( 'return pcall( php.error )' )->call();

assert( !$ok );

assert( $message === 'Something is wrong' );

?>

And I try with littel hopes to run with mediawiki and when I import the tamplate notice I have this error : Échec de l’importation : The luasandbox extension is not present, this engine cannot be used.

Translation of French part : import failed : ....

It's like it doesn’t exist.

Reply to "The content model 'sanitized-css' is not registered on this wiki."