Allow Apache to run ROOT

Hello All,

I have a successful ROOT install (Fixed location installation, /usr/local/bin/root and libs in /usr/local/lib/root/) and users on the CentOS machine can use it.

$ ls -l /usr/local/lib/root/libGui.so
-rwxrwxr-x 1 user1 user1 9303749 Nov 14 18:35 /usr/local/lib/root/libGui.so

My problem is that I want a php script to run a root executable. I see no output, and looking at the apache error log I see this:

[code][root@petcluster httpd]# cat error_log

/temp/analysis: error while loading shared libraries: libGui.so: cannot open shared object file: No such file or directory
/temp/analysis: error while loading shared libraries: libGui.so: cannot open shared object file: No such file or directory
/temp/analysis: error while loading shared libraries: libGui.so: cannot open shared object file: No such file or directory
/temp/analysis: error while loading shared libraries: libGui.so: cannot open shared object file: No such file or directory
…[/code]

I also tried the fixed installation path and in the php script, set the LD_LIBRARY_PATH path and still see the same message.

Any suggestion on how I fix this? Thanks in advance.

BK

Try setting the ROOTSYS as well as the LD_LIBRARY_PATH and see if that helps. It’s also possible it could be a security setting on Apache or perhaps you have SELinux enabled.

The right place to set the LD_LIBRARY_PATH is the /etc/sysconfig/httpd

However . . .
Can you elaborate a little bit more? What is the purpose of the your exercises?

I doubt one can build the robust bold Web service this way ( adding the ROOT to some Web application directly ). The service will be crashed too often. To make such functionality reliable we ended up with the Apache Web application that merely starts “pyroot” as the stand-alone process (so no apache env. is to be per-installed per-configured ) that communicates the ROOT results via some temporary file. The Web application starts ROOT process, pass the URL parameters and provides the temporary file name to communicate (or pipe). Upon the ROOT process termination, it picks that file to re-route it to the remote client over http (or embed it into the Web page). At this point the temporary file can be destroyed by the Web application (service)

See how it works:

pandamon.cern.ch/ppop
pandamon.cern.ch/ptimes see how it works.

My simulation has a lot of parameters, and I wanted users to set their own parameters and run the simulation and see the plots online. My php scrip passes runs the simulation and then uses root to make do the analysis.

I am inside a firewall and security is not really a concern.

[quote=“fine”]

However . . .
Can you elaborate a little bit more? What is the purpose of the your exercises?[/quote]

[quote=“karthikayan”]. . . I am inside a firewall and security is not really a concern… [/quote]Speaking “reliable” I did not mean the “security”. I meant the capability to delivery the result within the reasonable time frame, without confusing the innocent user, without 24/7 babysitting of your system.

Based on your description the model we use should fit your needs. It is simple to implement.

  1. Use the custom php to start your ROOT application and pass it the URL parameters and the name of the file to publish.
  2. Wait your application to fill the file with the name provided and terminate.
  3. Publish your file. ( the final file it is assumed to be in the “suitable” format already )

This way you do not need to set any ROOT env at the Apache level.
The env is to be set by your custom php application before staring the stand-alone ROOT process.

This is what our service does behind of scene.

I am doing exactly this and that was the problem: php is running a bash script and when it starts root, I get the errors mentioned in the first post.

[quote=“fine”]

  1. Use the custom php to start your ROOT application and pass it the URL parameters and the name of the file to publish.[/quote]

[quote=“karthikayan”] php is running a bash script and when it starts root, [/quote] Are you saying that your script looks like this:

ldd root.exe
root.exe -b hsimple.C  

Can you show us that script and say which user account this script uses ?
Can you demonstrate that you can start ROOT with no apache from the terminal under the same account?

My php code looks like this:

...
...
$command='/home/user1/webspectrum/runroot.sh '.$radiusT.' '.$RunTimeT.' '.$email;
passthru($command);
...

and runroot.sh looks like this:

#!/bin/bash
...
...
cd /home/user1/root/ ; 
source bin/thisroot.sh
cd -

/home/user1/webspectrum/spectrum $1 $2 $3

and /home/user1/webspectrum/spectrum is compiled root code

and I can run /home/user1/webspectrum/spectrum without problems from the terminal directly.

Thanks.

[quote=“fine”][quote=“karthikayan”] php is running a bash script and when it starts root, [/quote] Are you saying
that your script looks like this:

ldd root.exe
root.exe -b hsimple.C  

Can you show us that script and say which user account this script uses ?
Can you demonstrate that you can start ROOT with no apache from the terminal under the same account?[/quote]

Well,

  1. The approach does work (for us at least :slight_smile:
  2. Your “use case” is still not clear.
    One still needs to see what that ldd `which root.exe` or

ldd /home/user1/webspectrum/spectrum return been invoked by your php script.
By the way, why it needs libGui.so. PHP application is supposed to be the “batch” ROOT application with no GUI at all.