root@WebServer:
opkg updateroot@
WebServer
:
opkg install php5root@
WebServer
:
opkg install php-cgi
===== Konfigurasi uHTTPD =====
-- uncomment pada >> list interpreter “.php=/usr/bin/php-cgi”
root@
WebServer
:
/etc/config# nano uhttpd———-potong
#List of extension->interpreter mappings.
#Files with an associated interpreter can
#be called outside of the CGI prefix and do
#not need to be executable.
list interpreter “.php=/usr/bin/php-cgi”
# list interpreter “.cgi=/usr/bin/perl”
———–potong
-- save dan restart uhttpd
root@g-wrt:/etc/init.d# ./uhttpd stop
root@g-wrt:/etc/init.d# ./uhttpd start
===== Test PHP5 =====
isinya:
<?php
phpinfo();
?>
Buka browser,
http://ipaddress-router/tes-php.php
===== Enable MySQL Pada PHP5 =====
opkg update
opkg install php-mod-mysql
Edit file /etc/php.ini pada bagian:edit/tambahkan “short_open_tag = On” (tanpa tanda petik)
dan uncomment “extension=mysql.so” (tanpa tanda petik) pada bagian ; Dynamic Extensions
————potong
; Language Options
engine = On
;short_open_tag = Off
short_open_tag = On
precision = 12
y2k_compliance = On
————–potong
;extension=json.so
;extension=ldap.so
;extension=mbstring.so
;extension=mcrypt.so
extension=mysql.so
————–potong
===== PHP Script to Test MySQL =====
<?php $host = "localhost"; $user = "user12"; $pass = "34klq*"; $r = mysql_connect($host, $user, $pass); if (!$r) { echo "Could not connect to server\n"; trigger_error(mysql_error(), E_USER_ERROR); } else { echo "Connection established\n"; } echo mysql_get_server_info() . "\n"; mysql_close(); ?>
No comments:
Post a Comment