OpenWrt Forum Archive

Topic: PHP on the TP-Link TL-WR1043ND

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hallo und danke fürs lesen,

ich habe einen TR-WR1043ND Version 3 und habe mir OpenWrt
openwrt-ar71xx-generic-tl-wr1043nd-v3-squashfs-factory.bin
runter geladen und installiert.

Danach habe ich probiert Apache auf dem Gerät zu installieren. Das hat er auch gemacht aber es lies sich nicht starten. Ich bin dann auf den schon installierten uht tpd gestoßen und habe ihn benutzen wollen.
Als ist dann Mysql und PHP installieren wollte hatte ich zu wenig Speicherplatz und habe ein USB Medium als Root eingebunden.

Dann wollte ich PHP5 installieren, was aber nicht zu finden ist:

root@OpenWrt:~# opkg list php*
php7 - 7.1.2-1 - PHP is a widely-used general-purpose scripting language that is especially
 suited for Web development and can be embedded into HTML.
 This package contains only the PHP config file. You must actually choose
 your PHP flavour (cli, cgi or fastcgi).

 Please note, that installing php5 and php7 in parallel on the same target
 is not supported in OpenWrt/LEDE.
php7-cgi - 7.1.2-1 - PHP is a widely-used general-purpose scripting language that is especially
 suited for Web development and can be embedded into HTML.
 This package contains the CGI version of the PHP7 interpreter.
php7-cli - 7.1.2-1 - PHP is a widely-used general-purpose scripting language that is especially
 suited for Web development and can be embedded into HTML.
 This package contains the CLI version of the PHP7 interpreter.
php7-fastcgi - 7.1.2-1 - As FastCGI support is now a core feature the php7-fastcgi package now depends
 on the php7-cgi package, containing just the startup script.
php7-fpm - 7.1.2-1 - PHP is a widely-used general-purpose scripting language that is especially
 suited for Web development and can be embedded into HTML.
 This package contains the FastCGI Process Manager of the PHP7 interpreter.
php7-mod-calendar - 7.1.2-1 - Calendar shared module
php7-mod-ctype - 7.1.2-1 - Ctype shared module
php7-mod-curl - 7.1.2-1 - cURL shared module
php7-mod-dom - 7.1.2-1 - DOM shared module
php7-mod-exif - 7.1.2-1 - EXIF shared module
php7-mod-fileinfo - 7.1.2-1 - Fileinfo shared module
php7-mod-ftp - 7.1.2-1 - FTP shared module
php7-mod-gd - 7.1.2-1 - GD graphics shared module
php7-mod-gettext - 7.1.2-1 - Gettext shared module
php7-mod-gmp - 7.1.2-1 - GMP shared module
php7-mod-hash - 7.1.2-1 - Hash shared module
php7-mod-iconv - 7.1.2-1 - iConv shared module
php7-mod-intl - 7.1.2-1 - Internationalization Functions shared module
php7-mod-json - 7.1.2-1 - JSON shared module
php7-mod-ldap - 7.1.2-1 - LDAP shared module
php7-mod-mbstring - 7.1.2-1 - MBString shared module
php7-mod-mcrypt - 7.1.2-1 - Mcrypt shared module
php7-mod-mysqli - 7.1.2-1 - MySQL Improved Extension shared module
php7-mod-opcache - 7.1.2-1 - OPcache shared module
php7-mod-openssl - 7.1.2-1 - OpenSSL shared module
php7-mod-pcntl - 7.1.2-1 - PCNTL shared module
php7-mod-pdo - 7.1.2-1 - PHP Data Objects shared module
php7-mod-pdo-mysql - 7.1.2-1 - PDO driver for MySQL shared module
php7-mod-pdo-pgsql - 7.1.2-1 - PDO driver for PostgreSQL shared module
php7-mod-pdo-sqlite - 7.1.2-1 - PDO driver for SQLite 3.x shared module
php7-mod-pgsql - 7.1.2-1 - PostgreSQL shared module
php7-mod-phar - 7.1.2-1 - Phar Archives shared module
php7-mod-session - 7.1.2-1 - Session shared module
php7-mod-shmop - 7.1.2-1 - Shared Memory shared module
php7-mod-simplexml - 7.1.2-1 - SimpleXML shared module
php7-mod-soap - 7.1.2-1 - SOAP shared module
php7-mod-sockets - 7.1.2-1 - Sockets shared module
php7-mod-sqlite3 - 7.1.2-1 - SQLite3 shared module
php7-mod-sysvmsg - 7.1.2-1 - System V messages shared module
php7-mod-sysvsem - 7.1.2-1 - System V shared memory shared module
php7-mod-sysvshm - 7.1.2-1 - System V semaphore shared module
php7-mod-tokenizer - 7.1.2-1 - Tokenizer shared module
php7-mod-xml - 7.1.2-1 - XML shared module
php7-mod-xmlreader - 7.1.2-1 - XMLReader shared module
php7-mod-xmlwriter - 7.1.2-1 - XMLWriter shared module
php7-mod-zip - 7.1.2-1 - ZIP shared module
php7-pecl-dio - 0.0.9-1 - Direct I/O functions
php7-pecl-ht tp - 3.1.0-2 - Extended HT TP Support
php7-pecl-libevent - 2016-08-30-9e72744ce6224beafc7b54ce2a3a990f1c552a5a-1 - Libevent - event notification
php7-pecl-propro - 2.0.1-2 - Property proxy
php7-pecl-raphf - 2.0.0-2 - Resource and persistent handles factory

Ausschließlich die PHP7 Version ist verfügbar. Ich dachte mir das ist nicht so schlim, wird auch damit funktionieren.

Naja, ich bin jetzt so weit das ich den Luci nicht mehr als Startseite habe und eine php Datei erstellt habe welche theoretisch die php infos ausgeben soll. Anstatt die Internetseite zu laden wird aber der Fehler "BAD GATEWAY" angezeigt. Wenn ich aus der config von uht tpd die Zeile list interpreter ".php=/usr/bin/php-cgi" wieder raus nehme wird die php Datei runtergeladen sobald ich sie im Browser öffnen möchte.

Ich benötige den Router mit einem kleinen Webserver um ca. 15 Daten zu speichern und auszulesen.

Hier ein Auszug aus meiner php.ini

[PHP]
zend.ze1_compatibility_mode = Off

; Language Options

engine = On
;short_open_tag = Off
precision    =  12
y2k_compliance = On
output_buffering = Off
;output_handler =
zlib.output_compression = Off
;zlib.output_compression_level = -1
;zlib.output_handler =
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 100

;open_basedir =
disable_functions =
disable_classes =

; Colors for Syntax Highlighting mode.  Anything that's acceptable in
; <span style="color: ???????"> would work.
;highlight.string  = #DD0000
;highlight.comment = #FF9900
;highlight.keyword = #007700
;highlight.bg      = #FFFFFF
;highlight.default = #0000BB
;highlight.html    = #000000

;ignore_user_abort = On
;realpath_cache_size = 16k
;realpath_cache_ttl = 120

; Miscellaneous

expose_php = On

; Resource Limits

max_execution_time = 30    ; Maximum execution time of each script, in seconds.
max_input_time = 60    ; Maximum amount of time each script may spend parsing request data.
;max_input_nesting_level = 64
memory_limit = 8M    ; Maximum amount of memory a script may consume.
post_max_size = 8M

; Error handling and logging

; Error Level Constants:
; E_ALL             - All errors and warnings (includes E_STRICT as of PHP 6.0.0)
; E_ERROR           - fatal run-time errors
; E_RECOVERABLE_ERROR  - almost fatal run-time errors
; E_WARNING         - run-time warnings (non-fatal errors)
; E_PARSE           - compile-time parse errors
; E_NOTICE          - run-time notices (these are warnings which often result
;                     from a bug in your code, but it's possible that it was
;                     intentional (e.g., using an uninitialized variable and
;                     relying on the fact it's automatically initialized to an
;                     empty string)
; E_STRICT            - run-time notices, enable to have PHP suggest changes
;                     to your code which will ensure the best interoperability
;                     and forward compatibility of your code
; E_CORE_ERROR      - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING    - warnings (non-fatal errors) that occur during PHP's
;                     initial startup
; E_COMPILE_ERROR   - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR      - user-generated error message
; E_USER_WARNING    - user-generated warning message
; E_USER_NOTICE     - user-generated notice message
; E_DEPRECATED      - warn about code that will not work in future versions
;                     of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
;
; Common Values:
;   E_ALL & ~E_NOTICE  (Show all errors, except for notices and coding standards warnings.)
;   E_ALL & ~E_NOTICE | E_STRICT  (Show all errors, except for notices)
;   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR  (Show only errors)
;   E_ALL | E_STRICT  (Show all errors, warnings and notices including coding standards.)
; Default Value: E_ALL & ~E_NOTICE
error_reporting  =  E_ALL & ~E_NOTICE & ~E_STRICT

display_errors = On
display_startup_errors = Off
log_errors = Off
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
;report_zend_debug = 0
track_errors = Off
;html_errors = Off
;docref_root = "/phpmanual/"
;docref_ext = .html
;error_prepend_string = "<font color=#ff0000>"
;error_append_string = "</font>"
; Log errors to specified file.
;error_log = /var/log/php_errors.log
; Log errors to syslog.
;error_log = syslog

; Data Handling

;arg_separator.output = "&amp;"
;arg_separator.input = ";&"
variables_order = "EGPCS"
request_order = "GP"
register_globals = Off
register_long_arrays = Off
register_argc_argv = On
auto_globals_jit = On
post_max_size = 8M
;magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
;default_charset = "iso-8859-1"
;always_populate_raw_post_data = On

; Paths and Directories

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
doc_root = "/w w w"
user_dir =
extension_dir = "/usr/lib/php"
enable_dl = On
;cgi.force_redirect = 1
;cgi.nph = 1
;cgi.redirect_status_env = ;
cgi.fix_pathinfo=1
;fastcgi.impersonate = 1;
;fastcgi.logging = 0
;cgi.rfc2616_headers = 0

; File Uploads

file_uploads = On
upload_tmp_dir = "/tmp"
upload_max_filesize = 2M
max_file_uploads = 20

; Fopen wrappers

allow_url_fopen = On
allow_url_include = Off
;from="john@doe.com"
;user_agent="PHP"
default_socket_timeout = 60
;auto_detect_line_endings = Off

; Joachim hinzugefügt

extension=sockets.so

Hier ein Auszug aus meiner uht tpd config

config uht tpd 'main'
        option listen_ht tp '80'
        option home '/w w w'
        option index_page 'index.php'
        list interpreter ".php=/usr/bin/php-cgi"

Könntet ihr mir helfen?

English, please.

The discussion might have continued from here.