WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.9 R22 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • General Community »
  • Off-Topic »
  • viewing WB localy from USB webserver
  • Print
Pages: [1]   Go Down

Author Topic: viewing WB localy from USB webserver  (Read 29946 times)

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
viewing WB localy from USB webserver
« on: June 15, 2023, 02:48:11 PM »
Hi,

here is how I do it:

1. In config.php , do these changes
Code: [Select]
// 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!!

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


Logged
Web developer

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 626
Re: viewing WB localy from USB webserver
« Reply #1 on: June 15, 2023, 03:39:33 PM »
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: [Select]
print_r(getLocalIP());
Thanks a lot for this solution!!
Logged

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
Re: viewing WB localy from USB webserver
« Reply #2 on: June 15, 2023, 03:50:07 PM »
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.
Logged
Web developer

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 626
Re: viewing WB localy from USB webserver
« Reply #3 on: June 15, 2023, 04:54:48 PM »
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
Logged

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
Re: viewing WB localy from USB webserver
« Reply #4 on: June 15, 2023, 06:45:04 PM »
Can you post the examplr with virtual hosts , i didnt figure out how to make this
Logged
Web developer

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 626
Re: viewing WB localy from USB webserver
« Reply #5 on: June 15, 2023, 07:16:43 PM »
192.168.2.149 is the IP of my PC. On this Windows-PC runs a Apache24-Server && Mysql Server 8.0 && PHP in different versions

Code: [Select]
<VirtualHost 192.168.2.149:80>
    DocumentRoot "F:/cms/wb_test_1611"
    ServerName wb1611
    ServerAlias wb1611
    ErrorLog "F:/cms/wb_test_1611/local_error.log"
    <Directory "F:/cms/wb_test_1611">
        Options -Indexes +FollowSymLinks
        Options +SymLinksIfOwnerMatch
        AllowOverride All
        Require all granted
        DirectoryIndex index.php index.shtml index.html index.htm
        Require ip 192.168.2
        Require valid-user
    </Directory>   
</VirtualHost>
Logged

Offline crnogorac081

  • Posts: 2168
  • Gender: Male
Re: viewing WB localy from USB webserver
« Reply #6 on: June 15, 2023, 08:52:19 PM »
And you call it in browser http://wb1611:4443 ?
Logged
Web developer

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 626
Re: viewing WB localy from USB webserver
« Reply #7 on: June 16, 2023, 01:08:45 AM »
i dont use https at the moment, it come's later

i use http://192.168.2.149:80 on the iPad  and http://wb1611 directly on the PC and later, with https the same with the port 443

Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • General Community »
  • Off-Topic »
  • viewing WB localy from USB webserver
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2