RE: [PHP] read from comport: windows vs. linux - PHP
This is a discussion on RE: [PHP] read from comport: windows vs. linux - PHP ; > -----Original Message-----
> From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
> Sent: Tuesday, April 05, 2005 3:42 PM
> > having apache be the groupowner doesn´t change anything
> You may also need to change the user/owner, depending on what Apache is
...
-
RE: [PHP] read from comport: windows vs. linux
> -----Original Message-----
> From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
> Sent: Tuesday, April 05, 2005 3:42 PM
> > having apache be the groupowner doesn´t change anything
> You may also need to change the user/owner, depending on what Apache is
> running as.
User and group is apache. It made _no_ difference at all, I´m still getting permission denied, when calling fopen :-/
[root@lager dev]# ls -al ttyS*
crw-rw-rw- 1 apache apache 4, 64 Apr 5 16:01 ttyS0
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper
-
Re: [PHP] read from comport: windows vs. linux
On Wednesday 06 April 2005 14:41, Kim Madsen wrote:
> User and group is apache. It made _no_ difference at all, I´m still
> getting permission denied, when calling fopen :-/
>
> [root@lager dev]# ls -al ttyS*
> crw-rw-rw- 1 apache apache 4, 64 Apr 5 16:01 ttyS0
Well if "other" has "rw" then it doesn't really matter who owns the file.
What does the php error log say?
Are any of the safe mode stuff enabled?
Are you running SELinux?
Anyway the following works for me:
error_reporting(E_ALL);
//error_reporting(0);
ini_set('display_errors', TRUE);
if (!$fp = fopen("/dev/ttyS0", 'w+b')) {
echo "\nError! Could not open COMport - Got a terminal open?\n";
exit;
} else {
$i = 0;
while ((false !== ($char = fgetc($fp))) AND $i < 10) {
$i++;
echo "$i::[$char]<br>";
}
echo $i;
}
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts
-
RE: [PHP] read from comport: windows vs. linux
On Tue, April 5, 2005 11:41 pm, Kim Madsen said:
>
>> -----Original Message-----
>> From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
>> Sent: Tuesday, April 05, 2005 3:42 PM
>
>
>> > having apache be the groupowner doesn´t change anything
>
>> You may also need to change the user/owner, depending on what Apache is
>> running as.
>
> User and group is apache. It made _no_ difference at all, I´m still
> getting permission denied, when calling fopen :-/
>
> [root@lager dev]# ls -al ttyS*
> crw-rw-rw- 1 apache apache 4, 64 Apr 5 16:01 ttyS0
Just for fun...
On the command line, su to 'apache' and then do cat /dev/ttyS0
Okay, if that works, run your PHP script from the command line, as apache.
If *THAT* works, then I got nothin'
Report it as a bug, I guess. http://bugs.php.net
Though it's possible that the OS requires a shell to exist for you to open
/dev/ttyS0...
*MAYBE* you could try using http://php.net/exec (with "cat /dev/ttyS0")
and see if that allows you any kind of access. Doubt it, though.
--
Like Music?
http://l-i-e.com/artists.htm