0

I need to execute AT command from browser. My /etc/at.deny is empty and /etc/at.allow does not exists. I could execute "php page.php" on command line with any user and works fine.

Here is my page (page.php):

<?php
exec('at -f job.txt now + 1 minutes'); 
?>

My job.txt:

/bin/php /var/www/html/my_job.php 

So now I wan't to execute page.php when someone access my page.php from their browser:

https://mywebpage.com/page.php

I got this error "PAM failure: System error" from /var/log/httpd/error_log when someone access my page. I guess that this error is caused by permission issue, could someone please tell me how fix it or give me some suggestion. I can't found any answer or example online.

UPDATE

Thanks to Barmar reminded me that I should use full path. And now this is my new page.php, but I still getting same error "PAM failure". Any suggestion please?

<?php
exec('at -f /var/www/html/job.txt now + 1 minutes');
>?

I think that the main problem is AT command. If I remove the AT command and using 'sh' command it will work.

exec('sh /var/www/html/job.txt'); 

UPDATE:

So finally I found the problem, the SELinux block the apache to use atd command. Now I don't get "PAM failure" in error_log anymore after I set my SELinux to Permissive. However, I still getting some error, my /var/log/httpd/error_log appear 'job 47 at Sat May 26 22:38:00 2018', everything seem okay but my_job.php didn't works. Why? Did I miss something?

superrman777
  • 25
  • 1
  • 6

0 Answers0