title: MediaWiki Scribunto Lua error: Internal error: The interpreter exited with status 2
body: <p>I have done a fresh installation on my local development machine of MediaWiki 1.24.2.</p>
  
  <p>I have installed Scribunto and checked it is installed correctly on the list of extensions.</p>
  
  <p>I'm getting an error when I try and create an InfoBox.  The error is:</p>
  
  <p><strong>Lua error: Internal error: The interpreter exited with status 2</strong></p>
  
  <p>These are the steps I have taken the following steps to try and fix this.</p>
  
  <p>I have been to the Mediawiki Scribunto page</p>
  
  <p>I have added these lines to my LocalSettings.php file:</p>
  
  <pre><code>$wgScribuntoEngineConf['luastandalone']['memoryLimit'] = 209715200; # bytes
  $wgMaxShellMemory = 204800; # in KB
  </code></pre>
  
  <p>This has not fixed things. I'm a but confused as to how to switch on error logging.  The help page just says:</p>
  
  <p>Assigning a file path to $wgScribuntoEngineConf['luastandalone']['errorFile'] and examining that output can be valuable in diagnosing memory allocation errors.</p>
  
  <p>How do I assign a file path? - Solved Thanks for the help with this.</p>
  
  <p>I enclose a [link][2] to my php.ini file and my LocalSettings.php file (Zipped together)</p>
  
  <p><strong>UPDATE</strong> - I have now managed to add a log file and the error in the log file is:</p>
  
  <p>/var/www/extensions/Scribunto/engines/LuaStandalone/binaries/lua5_1_5_linux_32_generic/lua: Syntax error: "(" unexpected</p>
  
  <p><strong>UPDATE TWO</strong></p>
  
  <p>These are the full steps I take to replicate the error:</p>
  
  <p>Start by checking for any package updates available and installing them</p>
  
  <pre><code>sudo apt-get update
  sudo apt-get upgrade
  </code></pre>
  
  <p>Now install Apache, PHP and MySQL</p>
  
  <pre><code>sudo apt-get install apache2 -y
  sudo apt-get install php5 libapache2-mod-php5 -y
  sudo apt-get install mysql-server php5-mysql -y
  sudo apt-get install php-apc php5-intl imagemagick
  sudo apt-get install phpmyadmin
  </code></pre>
  
  <p>We can check the internal IP address of our Raspberry Pi with the following command (Make a note of it)</p>
  
  <p>hostname -I</p>
  
  <p>We can now create a database for our new MediaWIki installation. Start by logging in as root using the password you created earlier</p>
  
  <pre><code>mysql -u root -p
  </code></pre>
  
  <p>Here we are adding database=mediawikidb user=mediawikiuser and password=mediawikipassword:</p>
  
  <pre><code>CREATE DATABASE mediawikidb;
  CREATE USER mediawikiuser@localhost IDENTIFIED BY 'mediawikipassword';
  GRANT index, create, select, insert, update, delete, alter, lock tables on mediawikidb.* TO mediawikiuser@localhost;
  </code></pre>
  
  <p>Now we can make some changes to php.ini so we can increase the maximum file size and memory limit</p>
  
  <p>cd /etc/php5/apache2/
  nano php.ini</p>
  
  <p>Replace 'upload_max_filesize = 2M' with 'upload_max_filesize = 64M'</p>
  
  <p>Replace 'post_max_size = 8M' with 'post_max_size = 64M'</p>
  
  <p>Save the file</p>
  
  <p>Now we are going to empty the /var/www folder and change its ownership to pi</p>
  
  <pre><code>cd /var/www
  sudo chown pi: .
  sudo rm *
  </code></pre>
  
  <p>Now we can download MediaWiki, uncompress it and copy it into /var/www</p>
  
  <pre><code>mkdir /var/www/mediawiki
  wget http://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.2.tar.gz
  tar -xvzf mediawiki-*.tar.gz
  sudo mv mediawiki-*/* /var/www/
  </code></pre>
  
  <p>Now we can restart the relevant services</p>
  
  <pre><code>sudo service apache2 restart
  sudo service mysql restart
  </code></pre>
  
  <p>Now open a browser and go to localhost and start the installation</p>
  
  <p>To Complete Installation copy LocalSettings.php to /var/www/mediawiki</p>
  
  <p>Now install Scribunto</p>
  
  <p>Download from <a href="http://www.mediawiki.org/wiki/Special:ExtensionDistributor/Scribunto" rel="nofollow">http://www.mediawiki.org/wiki/Special:ExtensionDistributor/Scribunto</a></p>
  
  <pre><code>tar -xzf Scribunto-REL1_24-b060fbd.tar.gz -C /var/www/mediawiki/extensions
  </code></pre>
  
  <p>sudo nano /etc/mediawiki/LocalSettings.php</p>
  
  <p>add these lines at the end of the file and save</p>
  
  <p>require_once "$IP/extensions/Scribunto/Scribunto.php";</p>
  
  <p>$wgScribuntoDefaultEngine = 'luastandalone';</p>
  
  <p>$wgScribuntoEngineConf['luastandalone']['memoryLimit'] = 209715200; # bytes</p>
  
  <p>$wgMaxShellMemory = 204800; # in KB</p>
  
  <p>$wgScribuntoEngineConf['luastandalone']['errorFile'] = '/var/tmp/luaerror.log';</p>
  
  <pre><code>chmod -R 777 /var/www/mediawiki/extentions/Scribunto/engines/LuaStandalone/
  </code></pre>
  
  <p>Now visit '<a href="http://en.wikipedia.org/wiki/Special:Export" rel="nofollow">http://en.wikipedia.org/wiki/Special:Export</a>' and enter Template:Infobox in the big box.  Tick all three boxes and click Export</p>
  
  <p>Open the file in Notepad or similar and do a find and replace text/plain with CONTENT_FORMAT_TEXT </p>
  
  <p>Login to MediaWiki and go to Special:Import</p>
  
  <p>Once everything has imported correctly go to the homepage and enter this at the top of the page:</p>
  
  <pre><code>{{Infobox
  |title        = test Infobox
  |header1 = Main Heading
  |header2 = First set of data
  |label2  = Label
  |data2   = Data
  |header3 = Remove this line (optional)
  |label3  = More Label
  |data3   = More data
  }}
  </code></pre>
  
  <p>Many thanks</p>