gbizeau has asked for the wisdom of the Perl Monks concerning the following question:
My guess would be that the user the webserver runs under (often www-data) has no permissions to access /dev/ttyS0 (so the call to Device::SerialPort->new(...) fails and $pbx is undefined).
For example, on my system, /dev/ttyS0 is
$ ls -l /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 2009-09-06 04:09 /dev/ttyS0 [download]
and Apache (www-data) is not in group dialout (by default).