Install PHP, MySQL, JSON on your TL-MR3040 with OpenWRT - techonsteroids

Breaking

Post Top Ad

Responsive Ads Here

Post Top Ad

Responsive Ads Here

Friday, July 14, 2017

Install PHP, MySQL, JSON on your TL-MR3040 with OpenWRT









Be sure that you have internet connection on your TL-MR3040 with OpenWRT installed.
Then Type

opkg update

#Install uhttpd
opkg install uhttpd
uci set uhttpd.llmp=uhttpd
uci set uhttpd.llmp.listen_http=81
uci set uhttpd.llmp.home=/srv/www
uci commit uhttpd
mkdir -p $(uci get uhttpd.llmp.home)
/etc/init.d/uhttpd restart

#install PHP
opkg update
opkg list php*
opkg install php5 php5-cgi

# configure PHP
uci add_list uhttpd.llmp.interpreter=".php=/usr/bin/php-cgi"
uci set uhttpd.llmp.index_page="index.html index.htm default.html default.htm index.php"
uci commit uhttpd
sed -i 's,doc_root.*,doc_root = "",g' /etc/php.ini
sed -i 's,;short_open_tag = Off,short_open_tag = On,g' /etc/php.ini
/etc/init.d/uhttpd restart

#Install MySQL
opkg update
opkg install libpthread libncurses libreadline mysql-server
sed -i 's,^datadir.*,datadir         = "/srv/mysql",g' /etc/my.cnf
sed -i 's,^tmpdir.*,tmpdir          = "/tmp",g' /etc/my.cnf
mkdir -p /srv/mysql
mysql_install_db --force
/etc/init.d/mysqld start
/etc/init.d/mysqld enable
mysqladmin -u root password 'root'


#Comment: in case you try to open MySQL and got “ERROR 1045 (28000): Access #denied for user 'root'@'localhost' (using password: NO)” use:
#i. Open & edit “/etc/my.cnf”
#ii. Add “skip-grant-tables” under [mysqld]
#iii. /etc/init.d/mysqld restart

#Enable PHP
opkg update
opkg install php5-mod-mysql
sed -i 's,;extension=mysql.so,extension=mysql.so,g' /etc/php.ini


#Install MySQLi
opkg update
opkg install php5-mod-mysqli
sed -i 's,;extension=mysqli.so,extension=mysqli.so,g' /etc/php.ini
mysqli.default_socket = /var/run/mysqld.sock


#Check the /etc/php.ini, for example:
[MySQL]                                                                        
mysql.allow_local_infile = On                                                  
mysql.allow_persistent = On                                                    
mysql.cache_size = 2000                                                        
mysql.max_persistent = -1                                                      
mysql.max_links = -1                                                          
mysql.default_port = 3306                                                      
mysql.default_socket = /tmp/run/mysqld.sock                                    
mysql.default_host = 127.0.0.1                                                
mysql.default_user = root                                                      
mysql.default_password = root                                                  
mysql.connect_timeout = 60                                                    
mysql.trace_mode = Off


#Check  the /etc/config/uhttpd file, the
#Add the line:
list interpreter '.php=/usr/bin/php-cgi'

#For example:
config uhttpd 'main'
list listen_http '0.0.0.0:80'
list listen_http '[::]:80'
list listen_https '0.0.0.0:443'
list listen_https '[::]:443'
list interpreter ".php=/usr/bin/php-cgi"


#Install JSON
opkg update
opkg install php5-mod-json










No comments:

Post a Comment

Messaging Morse Code with TL-MR3040 Leds

#Install the  kmod-ledtrig-morse opkg install kmod-ledtrig-morse #list your leds ls -1 /sys/class/leds/ #enable mor...

Post Top Ad

Responsive Ads Here