Posted by:
cdt2u
(---.dsl.sta.abo.bbox.fr)
aaronkreider Wrote:
-------------------------------------------------------
> It turns out that modifying the environmental
> settings fixed this problem. I set the
> environmental settings to the ones used by the
> other user and now it works. It wasn't a
> permissions problem.
Thank you so much !!!
I've just been spending the night to resolve this nightmare. Your last post gave me the key.
So I'm sharing my issue in hope it could help someone else as your answer did with me.
I'm using Windows 8.1 / Wampserver 2.4 (php 5.4.12 / apache 2.4.4) / Code Blocks / MinGW all in x64
My problem was the following: I wanted to run an c++ executable through the exec() function in php. Problem was that I didn't get any output or error. Really weird.
At first, I did some tests :
- I simplified my executable so that it only displays the output "Hello World" when executed
- The other classic commands such as dir, whoami or ping did work through the exec() function in php
- When using the command line, my c++ executable worked perfectly
So it was not a problem of the executable not working nor the exec() function not enabled...
The long night journey began then, and I flipped through all forums I could get with all set of keywords possible...
- Some suggested to reinstall the c++ compiler in x32 (which I really didn't want to and finally didn't have had to),
- others said to redirect output from sdterr to sdtout.
- or using system(), shell_exec(), passthru(), proc_open() instead of exec()
- or using the program SetACL to set the user as admin on wampserver services (which didn't do anything at all for me)
- or changing the services' user when starting wampserver (which would then refuse to launch)
- or launching wampserver as an administrator
Neither of these solutions worked for me... So I was really going to lay my arms down...
Finally, I stumbled upon your post, looked to the environnement variables... Actually my MinGW and CMake paths were set for me but not for the system. So since Wampserver starts as the Local System, it didn't have the path for MinGW and CMake.
I changed the settings, crossed my fingers, refreshed my page and I couldn't believe my really-tired eyes, the output was there:
"Hello World!"
I was really happy... And it's true, now a new world is opening to me! I can run my c++ executable through my php... Such promising feats
Thank you again!!!!