Categories

See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

Can't run Mathematica on Raspberry Pi under php

General Tech Bugs & Fixes
Max. 2000 characters
Replies

usr_profile.png
Sam Curran

User

( 7 months ago )

 

Since Mathematica is contained in Raspberry Pi 2, I can do the following in the terminal:

echo "2+2" | /usr/local/bin/math -batchinput -batchoutput

It outputs 4 correctly. But when I try it with php:

<?php
$math="echo '2+2' | /usr/local/bin/math -batchinput -batchoutput";
$handle = popen($math, "r");
$str=fread($handle,200);
echo $str;
?>

It says that

Mathematica cannot find a valid password.

I find the license for Mathematica, in

/opt/Wolfram/WolframEngine/10.0/Configuration/Licensing/mathpass

Does this mean that Mathematica needs another license for interface with php?

UPDATE

I have solved this by adding an active key and password for the user www-data, which will stored in /var/www/.WolframEngine/Licensing/mathpass.

usr_profile.png
Nicola Aley

User

( 7 months ago )

 

Mathematica on the Raspberry Pi already comes with a license preinstalled, however running it as a user with insufficient access privileges may result in a prompt for activation or a password.

Here is a slightly more detailed explanation of what is happening, which is also discussed on Wolfram Community.

Early in the kernel (or FrontEnd) startup, as part of a series of hardware checks, Mathematica needs to talk to the Broadcom VideoCore chip. The default permissions for device should be similar to

crw-rw---- 1 root video 250, 0 Oct 27 22:17 /dev/vchiq

For example, if the user is not a member of the video group, opening the device will fail, resulting in a different $MachineID which no longer matches the preinstalled password. Hence, the product will not be activated.

A good way to resolve this issue is to check the device permissions are as above, and add the non-privileged user to the video group

sudo usermod -a -G video www-data

I have solved this by adding an active key and password for the user www-data

Yes, this will also work, but is more expensive: it requires the Pi owner (or his organization) to have purchased a Mathematica license. That is not necessary on the Raspberry Pi.

what's your interest


forum_ban8_5d8c5fd7cf6f7.gif