Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Executing system commands with PHP in archlinux


    I'm working on a small project and wondering if anyone could give me any advice or help.

    I'm trying to execute system commands in PHP that require root privileges on my Raspberry Pi.

    Basically, I need to read/write to some files in /sys/class/gpio using PHP.

    The problem is that Apache is running as the httpd user, which doesn't have any permissions. Normally I would edit the sudoers file, but this file doesn't exist on this distro.

    Apache can't be run as the root user, it basically tells me this when I change the config to run as root. I've also added the httpd user to the root group, but all these files have either 200 or 600 as their permissions, which resets on each boot up.

  2. #2
    Linux Guru Jonathan183's Avatar
    Join Date
    Oct 2007
    What you doing does not sound like a good security move to me ... but you could install sudo and use that

  3. #3
    Security is not an issue. All ports except for 80 will be disabled once finished. There will be no way for data sent to the device to be executed directly (So in otherwords, if (command=="bob") { exec ("echo bob"); } ). No physical access will be possible... it's inside a sealed box in my roof and hey if they get in there I have bigger issues to worry about!

    I've installed sudo like you suggested and it appears to be working fine, but is this the only way?

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts