Since several month, i m trying to user exec command in order to launch a file import in a business management application.
The software name is EBP, we must use a .exe file to do import.
Here is the command
"C:\Program Files\EBP\Invoicing11.0FRFR40\EBP.Invoicing.Application.exe"
/Gui=false;"C:INTERFACES_TESTALKORlogs20230307112630.txt " /Database="C:UsersPublicABPOST_TEST.ebp";USR;PASSWORD
/Import="C:INTERFACES_TESTALKORtodo230306151623_CDE_A638-00005912.csv";SaleOrders;SDK_ImportAlkorShop
If i launch it in a terminal, it works.
I would like to launch it with PHP. So in Symfony, i add a controller to do the import, in this controller i add the following lines:
$commande = escapeshellarg($this->ebpImportExecutable)
. ' /Gui=false;' . escapeshellarg($this->urlImportArkor.'logs\'.date('YmdHis').'.txt" ')
. ' /Database=' . escapeshellarg($this->database).';USR;PASSWORD'
. ' /Import=' . escapeshellarg($this->urlImportArkor . 'todo\' . $nomdufichier) . ';SaleOrders;SDK_ImportAlkorShop';
//echo $commande;exit();
exec($commande, $output, $retCode);
With Postman i tryed to to the import, the output of the exec command is an empty array.
In the Windows Application Log, i found the following error:
Application : EBP.Invoicing.Application.exe Version du Framework : v4.0.30319
Description : le processus a été arrêté en raison d'une exception non gérée.
Informations sur l'exception : System.ArgumentException à System.Security.Util.StringExpressionSet.CreateListFromExpressions(System.String[], Boolean)
à System.Security.Permissions.FileIOPermission.AddPathList(System.Security.Permissions.FileIOPermissionAccess, System.Security.AccessControl.AccessControlActions, System.String[], Boolean, Boolean, Boolean)
à System.Security.Permissions.FileIOPermission..ctor(System.Security.Permissions.FileIOPermissionAccess, System.String)
à System.Environment.InternalGetFolderPath(SpecialFolder, SpecialFolderOption, Boolean)
à EBP.Framework.Common.FoldersHelper+<>c.<.cctor>b__11_5()
à System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateValue()
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Value()
à EBP.Framework.Common.FoldersHelper+<>c.<.cctor>b__11_4()
à System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateValue()
à System.Lazy`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].LazyInitValue()
à EBP.Framework.Common.Log.LogHelper.GetIsLoggingEnabled()
à EBP.Framework.Common.Log.LogHelper.get_IsLoggingEnabled()
à EBP.Framework.Common.Log.LogHelper.Log(EBP.Framework.Common.Interfaces.Host.ISharedHostedApplication, Int16, System.Exception)
à EBP.Framework.Windows.Host.WinHost.CurrentDomain_UnhandledException(System.Object, System.UnhandledExceptionEventArgs)
Informations sur l'exception : System.TypeInitializationException
à 8xM=.BRQ=.TxQ=() à 8xM=.BRQ=.OBQ=() à EBP.Framework.BusinessLogic.Host.DataHostedApplication.Initialize(Boolean)
à EBP.Framework.Windows.Host.WinHostedApplication.Initialize(Boolean)
à EBP.Invoicing.Application.HostedApplication.Initialize(Boolean)
à EBP.Framework.Common.Host.HostBase.InitializeApplication(EBP.Framework.Common.Interfaces.Host.ISharedHostedApplication, Boolean)
à EBP.Framework.Windows.Host.WinHost.InitializeApplication(EBP.Framework.Common.Interfaces.Host.ISharedHostedApplication, Boolean)
à EBP.Framework.Common.Host.HostBase.Run(EBP.Framework.Common.Host.IHostedApplication, Boolean, System.String[])
à EBP.Invoicing.Application.Program.Main(System.String[])
There seems to be a permission error.
Does anybody have an idea ?
I tryed shell_exec and system command. i ve got the same issue.
Should i modify folder permission ?
Thank you