1

I am calling gcc through PHP by means of exec command. Then gcc gives weird errors such as "stddef.h cannot be found".

PHP is running under username "oracle". That is, when we call "whoami" through a PHP script by means of "exec", it gives oracle as the username.

We can easily call gcc without error on the terminal.

We can call "sudo -u oracle gcc source.c" without any error.

So it is very weird to me. Any ideas???

PS: It works fine on Fedora with Apache; and on Ubuntu with Apache.

memento
  • 319
  • 1
  • 2
  • 7
  • 1
    Check `dmesg(1)` or `/var/log/audit/audit.log` for SELinux AVC rejection / denied notices. – sarnold Dec 24 '11 at 09:09
  • 2
    If you use `#include` in your c file try appending `-I/usr/include/linux/` to your exec command. If you are using `#include` appending `-I/usr/include` should do it. – Shiplu Mokaddim Dec 24 '11 at 10:00
  • The source code is very simple (just a printf) and it only includes stdio.h Please note that it works well when using terminal. – memento Dec 24 '11 at 14:31

1 Answers1

0

Just compare environments under PHP and shell and see difference

dr-evil
  • 151
  • 2