hey thanks a lot guys ..sorry to bother you again .
i was opening the file directly from browser from the location htdocs ...i changed the file location to htdocs/xampp and it has started executing but there are some warnings as below :
Warning: Specified serial port is not valid in /opt/lampp/htdocs/xampp/php_serial.class.php on line 147
Warning: Unable to set the baud rate : the device is either not set or opened in /opt/lampp/htdocs/xampp/php_serial.class.php on line 241
Warning: Unable to set parity : the device is either not set or opened in /opt/lampp/htdocs/xampp/php_serial.class.php on line 295
... I have used the command : chmod 0777 /dev/ttyUSB0 to give permissions . I have also tried to add the apache user "prudhvi" to the dialout group by using command : $ usermod -a -G dialout prudhvi .
But it doesnt work . When I send a command directly from the terminal using the command : echo 1 > /dev/ttyUSB0 it works and '1' is transmitted to the serial port . But using php I get the above warnings .
I have used the "$whoami" to check name of user and added that user "prudhvi" to the dialout group . It still doesnt work . Please help me guys.