General Community > Off-Topic

viewing WB localy from USB webserver

(1/2) > >>

crnogorac081:
Hi,

here is how I do it:

1. In config.php , do these changes

--- Code: ---// Comment line below
// define('WB_URL',          "http://localhost:4001"); // no trailing slash or backslash!!

function getLocalIP(){
    exec("ipconfig /all", $output);
        foreach($output as $line){
            if (preg_match("/(.*)IPv4 Address(.*)/", $line)){
                $ip = $line;
                $ip = str_replace("IPv4 Address. . . . . . . . . . . :","",$ip);
                $ip = str_replace("(Preferred)","",$ip);
            }
        }
    return $ip;
}
define('WB_URL', 'http://'.str_replace(' ', '', getLocalIP()).':'.$_SERVER['SERVER_PORT']); // no trailing slash or backslash!!

--- End code ---

Make sure that Apache2/bin/httpd_usbwv8.exe and mysql/bin/mysqld_usbwv8.exe and usbwebserver.exe are included in firewall exception list, or you can simply disable firewall.


EDIt> run server, and when it opens homepage in browser http://localhost:443/index.php click any page and it will open url like http://192.168.1.123:4443/page1.php, so this IP address 192.168.1.123:4443 type on your phone tablet or another computer in local network.
***


I think this is it, but if doesnt work let me know, I will look into code again to see i there are more changes needed.

All best


sternchen8875:
a big step for me  ;-)

i try it in the past with the locale IP-Adress, but not with the port at the end.
result ist now: the iPad-Browser show's now the start page from my locale server on the PC, in my case the index.php from the htdocs-folder of the apache24-server.
On my locale PC-system, i use virtual hosts. this give me the possibility, to use a separat server name for every project and i can store the files on every place on the harddisc, outside from the htdocs-folder of the server

but your code give me the idea, to add vhosts also in WB-Portable and if its work, i've an example for my problem.
And if i found no solution for that, i can copy my project into the htdocs-Folder of my locale server and i test it without the virtual host. What i need, is a styling check for my modules in responsive displays and this "problem" is solved!   (Y) (Y)

if somebody try this code from crnogorac081 -
i use the german language on my PC and so i get the results from this function also in german. So i've to change the english word like "IPv4 Address" and "Preferred" to the german words "IPv4-Adresse" and "Bevorzugt". if you use a other language, print the results of this function to get the correct words with

--- Code: ---print_r(getLocalIP());
--- End code ---

Thanks a lot for this solution!!

crnogorac081:
cool im glad it works.

I dont know how you will solve multiple virtual hosts, because your phone or tablet doesnt know url for example http://my-project1 , 2, 3.. where will go... You would have to add manualy entry in hosts file for each phone/computer/tablet ,  thats why I have multiple wbportable instalations for each project.

sternchen8875:
It works.... yeah....

i cannot use a server name (at the moment - i dont know, how it works) but i can use your code, to work with a flexible IP-Adress. I've to add a new virtual host, called like my locale IP-Adress on the PC and now, i can work on both machines at the same time without changes every time.

The only problem at the moment: everything is hardcoded. if i want to work on a new project, i've to change the VirtualHost-Definition (other folders etc), but it doesn't matter

Thanks again  (Y)

*a nice day   :-D

crnogorac081:
Can you post the examplr with virtual hosts , i didnt figure out how to make this

Navigation

[0] Message Index

[#] Next page

Go to full version