Mex-file Error When Code Called From Web Server

Hi all,
I have written a program that uses PHP to call a background Matlab procedure.
For an example, the procedure is very simple:
function [ h ] = testProc( )
out='starting'
X=[2 3 4; 3 4 5;]
Y = pdist(X, 'spearman' )
out='ran'
h=0;
end
which is compiled using mcc:
mcc -m testProc.m
I can call this program from the command line and it runs just fine:
./run_testProc.sh /usr/local/MATLAB/R2011a/
But when I wrap it in some PHP and call it from the web page:
$cmd='./run_testProc.sh /usr/local/MATLAB/R2011a/';
$output=shell_exec($cmd);
It initially starts running, but then crashes when it hits the pdist function, presumably because it's not seeing the libraries correctly. From the logs this is the error:
??? Invalid MEX-file
'/tmp/.mcrCache7.15/testPr0/toolbox/stats/stats/private/pdistmex.mexglx':
/tmp/.mcrCache7.15/testPr0/toolbox/stats/stats/private/pdistmex.mexglx: failed
to map segment from shared object: Operation not permitted
Error in ==> pdist at 273
Error in ==> testProc at 5
MATLAB:invalidMEXFile
I'm assuming this is some sort of permissions issue with the install. My Unix admin skills aren't very good but our systems administrator has been trying help, yet we are still stuck.
Any insight at all would be appreciated.
Thank you!!!
Michele

Respuestas (1)

Kaustubha Govind
Kaustubha Govind el 30 de Abr. de 2012

0 votos

See if this solution helps.

1 comentario

Friedrich
Friedrich el 30 de Abr. de 2012
Good start, but one can't simply copy around the mcr cache. One needs the MCR_CACHE_ROOT environment variable to specify the extraction path of the ctf content:
http://www.mathworks.com/help/releases/R2012a/toolbox/compiler/brl4_f1-1.html

Iniciar sesión para comentar.

Categorías

Más información sobre C Shared Library Integration en Centro de ayuda y File Exchange.

Preguntada:

el 27 de Abr. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by