Skip to main content
added 159 characters in body
Source Link

In pursuing the inability of PHP called bash script to run/provide exigrep results, I copied the exigrep file located in /usr/sbin/exigrep to the local account directory containing my PHP file. When I changed the bash script exigrep calls to /home/account/public_html/cgi-bin/exigrep, the log file extract worked properly.

So at least I have a workaround.

I conclude that my original problem is not a linux issue but rather a PHP issue. It appears that for some reason PHP cannot execute the system copy of exigrep. Perhaps the fact that it is a Pearl script is a factor.

To further explore this I made a simple exigrep call from the PHP directly (no bash script involved):

<?php
$output = shell_exec('exigrep email /var/log/exim_mainlog');
echo "<pre>$output</pre>";
?>

which did not work.

However when my account located copy of exigrep was called, it works correctly:

<?php
$output = shell_exec('/home/account/public_html/cgi-bin/exigrep email /var/log/exim_mainlog');
echo "<pre>$output</pre>";
?>

It would be nicebeneficial to understand this better, in that if all Perl scripts will be problematic in this manner, one would have to copy all those needed to the local account directory. Not Naturally it would be better to change whatever is preventing the exigrep script from being executed in its normal "home".

This is not a very robust solution, but at least I canrather a workaround that lets me get results and perform my investigations.

In pursuing the inability of PHP called bash script to run/provide exigrep results, I copied the exigrep file located in /usr/sbin/exigrep to the local account directory containing my PHP file. When I changed the bash script exigrep calls to /home/account/public_html/cgi-bin/exigrep, the log file extract worked properly.

So at least I have a workaround.

I conclude that my original problem is not a linux issue but rather a PHP issue. It appears that for some reason PHP cannot execute the system copy of exigrep. Perhaps the fact that it is a Pearl script is a factor.

To further explore this I made a simple exigrep call from the PHP directly (no bash script involved):

<?php
$output = shell_exec('exigrep email /var/log/exim_mainlog');
echo "<pre>$output</pre>";
?>

which did not work.

However when my account located copy of exigrep was called, it works correctly:

<?php
$output = shell_exec('/home/account/public_html/cgi-bin/exigrep email /var/log/exim_mainlog');
echo "<pre>$output</pre>";
?>

It would be nice to understand this better, in that if all Perl scripts will be problematic in this manner, one would have to copy all those needed to the local account directory. Not a very robust solution, but at least I can get results and perform my investigations.

In pursuing the inability of PHP called bash script to run/provide exigrep results, I copied the exigrep file located in /usr/sbin/exigrep to the local account directory containing my PHP file. When I changed the bash script exigrep calls to /home/account/public_html/cgi-bin/exigrep, the log file extract worked properly.

So at least I have a workaround.

I conclude that my original problem is not a linux issue but rather a PHP issue. It appears that for some reason PHP cannot execute the system copy of exigrep. Perhaps the fact that it is a Pearl script is a factor.

To further explore this I made a simple exigrep call from the PHP directly (no bash script involved):

<?php
$output = shell_exec('exigrep email /var/log/exim_mainlog');
echo "<pre>$output</pre>";
?>

which did not work.

However when my account located copy of exigrep was called, it works correctly:

<?php
$output = shell_exec('/home/account/public_html/cgi-bin/exigrep email /var/log/exim_mainlog');
echo "<pre>$output</pre>";
?>

It would be beneficial to understand this better, in that if all Perl scripts will be problematic in this manner, one would have to copy all those needed to the local account directory. Naturally it would be better to change whatever is preventing the exigrep script from being executed in its normal "home".

This is not a very robust solution, but rather a workaround that lets me get results and perform my investigations.

Source Link

In pursuing the inability of PHP called bash script to run/provide exigrep results, I copied the exigrep file located in /usr/sbin/exigrep to the local account directory containing my PHP file. When I changed the bash script exigrep calls to /home/account/public_html/cgi-bin/exigrep, the log file extract worked properly.

So at least I have a workaround.

I conclude that my original problem is not a linux issue but rather a PHP issue. It appears that for some reason PHP cannot execute the system copy of exigrep. Perhaps the fact that it is a Pearl script is a factor.

To further explore this I made a simple exigrep call from the PHP directly (no bash script involved):

<?php
$output = shell_exec('exigrep email /var/log/exim_mainlog');
echo "<pre>$output</pre>";
?>

which did not work.

However when my account located copy of exigrep was called, it works correctly:

<?php
$output = shell_exec('/home/account/public_html/cgi-bin/exigrep email /var/log/exim_mainlog');
echo "<pre>$output</pre>";
?>

It would be nice to understand this better, in that if all Perl scripts will be problematic in this manner, one would have to copy all those needed to the local account directory. Not a very robust solution, but at least I can get results and perform my investigations.