• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

DIO enable?

mcl024

Neues Mitglied
Hallo,

ich probiere gerade über das folgende php-script, welches auf einem XAMPP Webserver unter Suse 11.1. läuft, auf meine RS232 Schnittstelle zuzugreifen.

PHP:
<?php
    $fd = dio_open('/dev/ttyS0', O_RDWR | O_NOCTTY | O_NONBLOCK);
      dio_fcntl($fd, F_SETFL, O_SYNC);
      dio_tcsetattr($fd, array(    'baud' => 9600,
                                   'bits' => 8,
                                   'stop'  => 1,
                                   'parity' => 0));

      $Sende="1";
      dio_write($fd,$Sende);
      dio_close($fd);
    ?>
Ich bekomme allerdings im Browser immer folgende Fehlermeldung.

Fatal error: Call to undefined function dio_open() in /opt/lampp/htdocs/firstpage/uart.php on line 2

Woher weiss ich ob DIO Funktionen aktiviert sind und wie kann ich es aktivieren.
Ich bin absoluter Anfänger was Linux und php angeht.

Danke für eure Antworten
 
Stell sicher, dass dein PHP mit --enable-dio übersetzt wurde (siehe phpinfo()). DIO ist eigentlich eine Standardkomponente.
 
Wenn unter phpinfo() in der Spalte Configure Commands folgendes steht:

'./configure' '--prefix=/opt/lampp' '--with-apxs2=/opt/lampp/bin/apxs' '--with-config-file-path=/opt/lampp/etc' '--with-mysql=mysqlnd' '--enable-inline-optimization' '--disable-debug' '--enable-bcmath' '--enable-calendar' '--enable-ctype' '--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' '--enable-force-cgi-redirect' '--enable-ftp' '--enable-gd-imgstrttf' '--enable-gd-native-ttf' '--with-ttf' '--enable-magic-quotes' '--enable-memory-limit' '--enable-shmop' '--disable-sigchild' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-wddx' '--enable-yp' '--with-ftp' '--with-gdbm=/opt/lampp' '--with-jpeg-dir=/opt/lampp' '--with-png-dir=/opt/lampp' '--with-freetype-dir=/opt/lampp' '--without-xpm' '--with-zlib=yes' '--with-zlib-dir=/opt/lampp' '--with-openssl=/opt/lampp' '--with-expat-dir=/opt/lampp' '--enable-xslt=/opt/lampp' '--with-xsl=/opt/lampp' '--with-dom=/opt/lampp' '--with-ldap=/opt/lampp' '--with-ncurses=/opt/lampp' '--with-gd' '--with-imap-dir=/opt/lampp' '--with-imap-ssl' '--with-imap=/opt/lampp' '--with-gettext=/opt/lampp' '--with-mssql=/opt/lampp' '--with-sybase-ct=/opt/lampp' '--with-interbase=shared,/opt/interbase' '--with-mysql-sock=/opt/lampp/var/mysql/mysql.sock' '--with-oci8=shared,instantclient,/opt/lampp/lib/instantclient' '--with-mcrypt=/opt/lampp' '--with-mhash=/opt/lampp' '--enable-sockets' '--enable-mbstring=all' '--with-curl=/opt/lampp' '--enable-mbregex' '--enable-zend-multibyte' '--enable-exif' '--with-bz2=/opt/lampp' '--with-sqlite=shared,/opt/lampp' '--with-sqlite3=/opt/lampp' '--with-libxml-dir=/opt/lampp' '--enable-soap' '--enable-pcntl' '--with-mysqli=mysqlnd' '--with-mime-magic' '--with-pgsql=shared,/opt/lampp/postgresql' '--with-iconv' '--enable-dio' '--with-pdo-mysql=mysqlnd' '--with-pdo-pgsql=/opt/lampp/postgresql' '--with-pdo-sqlite' '--enable-intl' '--with-icu-dir=/opt/lampp' '--enable-fileinfo' '--enable-phar'

bedeutet das dann das dio übersetzt wurde.
Wenn ja was ist dann das Problem?
 
Ja. DIO ist jedem Fall einkompiliert.

Ist evtl. Safemode an oder die Methode als disabled_functions definiert?
 
Also in der php.ini ist safe-mode = OFF und unter disable_functions ist nicht eingetragen. An der RS232 Schnittstelle kann es auch nicht liegen den mit fopen funktioniert es wunderbar.
 
Ich weiss nicht wie das installieren soll. Unter Yast kann ich nichts finden. Ich verstehe das nicht mit PEAR und PECL.

Bitte, brauche ein wenig Unterstützung.
 
So erstmal vielen Dank für die Antworten.
Ich habe es nun endlich geschafft das dio Packet zu installieren und zu compilieren.

Beim start von meinem Xampp server kommt nun folgende Fehlermeldung.
Code:
Warning: PHP Startup: dio: Unable to initialize module
Module compiled with module API=20060613
PHP    compiled with module API=20090626
These options need to match
 in Unknown on line 0
XAMPP: Starte Apache mit SSL (und PHP5)...
XAMPP: Starte MySQL...
XAMPP: Starte ProFTPD...
XAMPP fuer Linux gestartet.
 
Scheinbar wurde das Modul für eine wesentlich ältere PHP-Version übersetzt. Musst du zusehen, die aktuelle Version von Dio zu installieren: also 0.0.4
 
Das ist schlecht, da fopen() nur in Verbindung mit einem Programm welches auf die RS232 Schnittstelle zugreift funktioniert hat. Das ist mir erst aufgefallen als ich das Programm HTERM geschlossen habe.
 
Hat keiner mehr ne Idee. Das kann doch nichts großes mehr sein. Wie kommt den das Modul DIO zu der falschen API?
 
Zurück
Oben