Personal tools
You are here: Home Forum Use using Salome9.6 with in AWS with apache2 and PHP

using Salome9.6 with in AWS with apache2 and PHP

Up to Use


This forum is DEPRECATED, please create new topics in the new SALOME forum.
For existing topics please transfer them to the new forum.

using Salome9.6 with in AWS with apache2 and PHP

Posted by pulpormrm at December 21. 2021
I have installed SALOME-9.6.0-UB20.04-SRC on EC2-AWS with Ubuntu 20.04. 
 
When I use salome to run a script from shell command line: "/home/user/SALOME-9.6.0-UB20.04-SRC/salome -t /home/user/RQSTDIR/cadLoader.py > /home/user/log.txt" the script works perfectly, and so I am sure that the setup is ok.
 
I also installed PHP 7.3 and Apache2 on the same machine. I tested PHP, and from PHP console, using PHP command "system();" I am also able to run the same script and salome executes the script as it is expected. So also PHP is working well.
 
Now, with Apache2 I serve a webpage containing a simple button to call PHP to execute the salome script:
 
Web button ->
<?php
system('/home/user/SALOME-9.6.0-UB20.04-SRC/salome -t /home/user/cadLoader.py > /home/user/log.txt', $output);
echo "<pre>$output</pre>";
?>
I obtain the following message error from the log.txt file:
 
runSalome running on ip-172-31-7-180
Searching for a free port for naming service: 2870 - OK
Searching Naming Service  + found in 0.1 seconds
Searching /Registry in Naming Service  + found in 0.5 seconds
Searching /Kernel/ModulCatalog in Naming Service  + found in 0.5 seconds
RunStudy
Searching /Study in Naming Service  + found in 0.5 seconds
Searching /Containers/ip-172-31-7-180/FactoryServer in Naming Service  ++++salome.salome_init(): Salome Exception : Error: Cannot resolve ContainerManager in Naming Service

        ============================================
        May be there is no running SALOME session
        salome.salome_init() is intended to be used
        within an already running session
        ============================================

 found in 2.0 seconds
Start SALOME, elapsed time :   3.7 seconds
 
I add here the error message I traced from apache2 error.log file:
 
th. 139782508386112 - Trace /volatile/salome/jenkins/workspace/Salome_master_UB20/SALOME-9.6.0-UB20.04/SOURCES/KERNEL/src/ModuleCatalog/SALOME
_ModuleCatalog_Server.cxx [101] : Module Catalog Server: Naming Service was found
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Traceback (most recent call last):
  File "/home/ubuntu/cadLoader.py", line 11, in <module>
    salome.salome_init()
  File "/home/ubuntu/SALOME-9.6.0-UB20.04-SRC/BINARIES-UB20.04/KERNEL/lib/python3.6/site-packages/salome/salome/__init__.py", line 191, in sal
ome_init
    orb, lcc, naming_service, cm, esm, dsm = salome_kernel_init()
  File "/home/ubuntu/SALOME-9.6.0-UB20.04-SRC/BINARIES-UB20.04/KERNEL/lib/python3.6/site-packages/salome/salome_kernel.py", line 51, in salome
_kernel_init
    lcc = LifeCycleCORBA(orb)
  File "/home/ubuntu/SALOME-9.6.0-UB20.04-SRC/BINARIES-UB20.04/KERNEL/bin/salome/LifeCycleCORBA.py", line 36, in __init__
    SALOME_LifeCycleCORBA.__init__(self)
  File "/home/ubuntu/SALOME-9.6.0-UB20.04-SRC/BINARIES-UB20.04/KERNEL/lib/python3.6/site-packages/salome/libSALOME_LifeCycleCORBA.py", line 17
5, in __init__
    this = _libSALOME_LifeCycleCORBA.new_SALOME_LifeCycleCORBA(ns)
RuntimeError: Salome Exception : Error: Cannot resolve ContainerManager in Naming Service
ERROR:salomeContext:SystemExit 1 in method _runAppli.
 
What makes me nut is that Salome works, it is only when I use Apache2 to execute the script that I obtain this error.
Any help please?
 

Re: using Salome9.6 with in AWS with apache2 and PHP

Posted by ghodbane at December 27. 2021

Hi Juan,

I could reproduce the issue which is related to omniORB. To cope with this issue, you could try to use the so called session less mode in SALOME 9.7.0 by setting SALOME_EMB_SERVANT=1 (experimental)

Enclosed a small use case which uploads a python script which implements a box in GEOM and meshes it with Body fitter.

HTH.

 

 

 

Attachments

Re: using Salome9.6 with in AWS with apache2 and PHP

Posted by pulpormrm at December 30. 2021
Hi all. Just a word to confirm that Nabil G. solution does work fine for me and the issue is solved. More precisley, instead of using the command: 
"/home/user/SALOME-9.7.0-UB20.04-SRC/salome -t /directory-to-Python-script/script.py"
 
I use (with version 9.7 Salome):
"SALOME_EMB_SERVANT=1 /home/user/SALOME-9.7.0-native-UB20.04-SRC/salome --shutd
own-servers 1 --terminal /directory-to-Python-script/script.py"
 
In this way (session less mode) Salome runs and the script.py is excuted when I call Salome via PHP from a web page.
 
Big thank you to Nabil G.


This forum is DEPRECATED, please create new topics in the new SALOME forum.
For existing topics please transfer them to the new forum.

Powered by Ploneboard
Document Actions