Update ip of wordpress in ksweb webserver

If you need a wordpress blog locally on phone,
you could install ksweb on android.

But you phone have a different ip each wireless, then wordpress don’t work because he use absolute path.

you need change ip before using the blog.

You could make a php file that change ip.

<?php
define( 'DB_HOST', 'localhost' );
define( 'DB_USER', 'blog_user' );
define( 'DB_PASSWORD', 'blog_pass');
define( 'DB_NAME', 'blog' );

$i=$_GET['i'];
//connessione al db
$conn_id = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die ('KO|500|Internal Server Error');
@mysql_select_db(DB_NAME, $conn_id) or die ('KO|500|Internal Server Error');
// @mysql_query("SET NAMES '".DB_CHARSET."'", $conn_id) or die ('KO|500|Internal Server Error');
 
$query = "update wp_options set option_value='".$i."' where option_id = 1;";
 mysql_query($query, $conn_id);
 
$query = "update wp_options set option_value='".$i."' where option_id = 2;";
 mysql_query($query, $conn_id);
?>

run script before launch blog with:

http://localhost/script.php?i=192.168.0.100

see next post for launch it with tasker

Leave a Reply

Your email address will not be published. Required fields are marked *