Kako povezati Apache i MySQL koji se nalaze na dva različita virtualna računala?

Pozdrav svima
Imam problem, ispričavam se ako sam na krivom podforumu, trebam napraviti 2 virtualna računala što sam i napravio u programu vmware workstacion, sad je problem sljedeći pošto sam novi u ovome i moje znanje o serverima je skoro pa nikakvo molio bih za upute i pomoć. Na jednom virtualnom računalu trebam instalirati Apache a na drugom MySQL, to sam napravio, sad kako da podesim MySQL a kako Apache da komuniciraju jedan sa drugim, kako da sa Apache koji je na jednom računalu pristupim MySQL bazi koja je na drugom računalu?[indent]___________________
[color=green][size=4]Naslov izmijenjen u skladu s pravilima, a kao primjer autoru za buduće imenovanje tema.

  • tsereg[/size][/color][/indent]

Savjetujem da proučiš osnove, jer se Apache ne povezuje na mySQL, već server side skripta, recimo PHP. Spajanje nije ništa drugačije u odnosu na scenario kada je baza na istom poslužitelju kao i Web server - u tvom slučaju ćeš se umjesto na localhost spajati na hostname i port na kojem je pokrenuta (ispravno konfigurirana) baza.

Posto se VM-ovi nalaze iza NAT-a (ako nisu u briged mode !? )moras kao prvo otvoriti portove te tek onda mysqlu reci da prihvaca konekcije “izvana”

Hvala vam na odgovoru pokušat ću

Nikako ne ide. Moželi mi ovo netko malo detaljnije objasniti ili me uputiti na neki turtorial?

Moras nam vise reci da bi mogli znati…

Pitanja:

Dali su vmovi na istom stroju
Dali glavni nodovi imaju Firewall
Dali su glavni nodovi u lokalnoj mrezi tipa 192.168.x.x
Dali postoji izmedju njih neki ruter ili samo switch
Dali su otvoreni portovi na Vm-ovima
U kojem je modusu network, NAT, Bridget… itd
I kao zadnje skripta koja se spaja na mysql kako izgleda

Kada dobijemo odgovore na gore postavljena pitanja mozemo dalje

lp
Alen

Da vmovi su na istom fizičkom stroju
Firewall je isključen
Nisu u lokalnoj mreži
Nema ni rutera ni switcha
Otvoreni su portovi (80)
Network je u NAT modusu
Skripta

<? if (!$db=@mysql_connect("localhost", "root", "lozinka")) { die ("Spajanje na mysql server je bilo neuspješno"); } if (!mysql_select_db("naziv baze", $db)) { die ("Greška pri odabiru baze"); } ?>

Samo me još zanima jučer sve ponovno instalirao (php i apache) i radilo mi kad upišem u pretraživač localhost izbaci mi it works ali danas mi evo izbacuje Forbidden You don’t have permission to access /php/php.exe/index.html on this server.

trebao bi urediti permisije na file kojeg pokušavaš otvoriti. MySQL inaće ne radi na portu 80.
Mislim da je neki port untar tri tisuće 3036, tako nešto.

ok odlicno vec imamo materijala :slight_smile:

dakle:

1: otvorit portove na oba vm-a i to 3306 TCP
2: if (!$db=@mysql_connect(“localhost”, “root”, “lozinka”)) “localhost” treba zamjeniti ipadresom od DB servera
3: pokusati pozvati skriptu te u drugom shel/bash prozoru live gledati mysql logove koji je obicno nalaze u /var/log ako nije drukcije definitano u my.cnf fajlu

naredba za live log je " tail -f /uptanja/prema /mysql.log"

[quote=“dragan1201”]
Samo me još zanima jučer sve ponovno instalirao (php i apache) i radilo mi kad upišem u pretraživač localhost izbaci mi it works ali danas mi evo izbacuje Forbidden You don’t have permission to access /php/php.exe/index.html on this server.[/quote]

pogedati logove od apache servera a nalaze se obicno ako ne i uvijek :slight_smile: u /var/log

p.s: /php/php.exe/index.html ovo je nadam se samo tvoj primjer jer .html falovi se obicno nalaze u /var/www foderu a i .exe fajl nema sta traziti na jednom linux serveru :zbogom:

Ok hvala puno čim budem imao vremena bacam se na posao

Opet poruka Forbidden You don’t have permission to access /php/php.exe/index.html on this server

I da to je samo primjer

sta kazu logovi od apache servera a nalaze se obicno ako ne i uvijek :slight_smile: u /var/log

“You don’t have permission to access /php/php.exe/index.html on this server”

obicno jedna komanda “chmod 644 /php/php.exe/index.html” rijesava probleme ako to nije dovoljno onda dignuti na 755 no samo dok se nerijesi greska jer 755 je malo previse prava za ostale

isto pogledati tko je “vlasnik” fajla a trebao bi biti httpd,apache, www ili tko vec zavisi od distribucije linuxa

Ispričavam se možda nisam napomenuo ali se ne radi o linux-u nego windows xp profesional
Imaju neke 3 datoteke u logs mapi

access.log

127.0.0.1 - - [24/Oct/2011:15:53:04 +0200] “GET / HTTP/1.1” 200 44
127.0.0.1 - - [24/Oct/2011:15:53:31 +0200] “GET / HTTP/1.1” 304 -
127.0.0.1 - - [24/Oct/2011:15:54:21 +0200] “GET / HTTP/1.1” 200 44
127.0.0.1 - - [24/Oct/2011:15:54:30 +0200] “GET /primjer.php HTTP/1.1” 200 527
127.0.0.1 - - [24/Oct/2011:16:13:08 +0200] “GET / HTTP/1.1” 200 44
127.0.0.1 - - [24/Oct/2011:16:13:18 +0200] “GET /konekcija.php HTTP/1.1” 200 184
127.0.0.1 - - [24/Oct/2011:17:01:49 +0200] “GET / HTTP/1.1” 200 44
127.0.0.1 - - [24/Oct/2011:17:01:58 +0200] “GET /konekcija.php HTTP/1.1” 200 236
127.0.0.1 - - [25/Oct/2011:18:16:04 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [25/Oct/2011:18:16:46 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [25/Oct/2011:18:16:48 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [25/Oct/2011:18:16:48 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [25/Oct/2011:18:16:56 +0200] “GET /primjer.php HTTP/1.1” 403 225
127.0.0.1 - - [25/Oct/2011:18:24:46 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [25/Oct/2011:18:24:47 +0200] “GET /favicon.ico HTTP/1.1” 404 209
127.0.0.1 - - [25/Oct/2011:18:24:50 +0200] “GET /favicon.ico HTTP/1.1” 404 209
127.0.0.1 - - [25/Oct/2011:18:31:05 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [25/Oct/2011:18:31:08 +0200] “GET /favicon.ico HTTP/1.1” 404 209
127.0.0.1 - - [25/Oct/2011:18:32:10 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [25/Oct/2011:18:32:12 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:35:20 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:35:23 +0200] “GET /favicon.ico HTTP/1.1” 404 209
127.0.0.1 - - [26/Oct/2011:16:36:16 +0200] “GET /php%20mysql HTTP/1.1” 404 207
127.0.0.1 - - [26/Oct/2011:16:36:43 +0200] “GET /php%20mysql/dbspoj.php HTTP/1.1” 404 218
127.0.0.1 - - [26/Oct/2011:16:39:23 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:39:24 +0200] “GET /favicon.ico HTTP/1.1” 404 209
127.0.0.1 - - [26/Oct/2011:16:40:45 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:40:46 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:40:46 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:40:46 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:40:46 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:40:47 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:40:47 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:40:47 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:40:47 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:44:43 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:16:44:43 +0200] “GET /favicon.ico HTTP/1.1” 404 209
127.0.0.1 - - [26/Oct/2011:17:21:35 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:17:22:06 +0200] “GET / HTTP/1.1” 403 224
127.0.0.1 - - [26/Oct/2011:17:22:09 +0200] “GET /favicon.ico HTTP/1.1” 404 209

error.log

Starting the Apache2.2 service
The Apache2.2 service is running.
] Apache/2.2.21 (Win32) configured – resuming normal operations
[Mon Oct 24 15:41:50 2011] [notice] Server built: Sep 9 2011 10:26:10
[Mon Oct 24 15:41:50 2011] [notice] Parent: Created child process 2280
[Mon Oct 24 15:41:50 2011] [notice] Child 2280: Child process is running
[Mon Oct 24 15:41:50 2011] [notice] Child 2280: Acquired the start mutex.
[Mon Oct 24 15:41:50 2011] [notice] Child 2280: Starting 64 worker threads.
[Mon Oct 24 15:41:50 2011] [notice] Child 2280: Starting thread to listen on port 80.
[Tue Oct 25 18:09:20 2011] [warn] pid file C:/Inet/logs/httpd.pid overwritten – Unclean shutdown of previous Apache run?
[Tue Oct 25 18:09:20 2011] [notice] Apache/2.2.21 (Win32) configured – resuming normal operations
[Tue Oct 25 18:09:20 2011] [notice] Server built: Sep 9 2011 10:26:10
[Tue Oct 25 18:09:20 2011] [notice] Parent: Created child process 1876
[Tue Oct 25 18:09:20 2011] [notice] Child 1876: Child process is running
[Tue Oct 25 18:09:20 2011] [notice] Child 1876: Acquired the start mutex.
[Tue Oct 25 18:09:20 2011] [notice] Child 1876: Starting 64 worker threads.
[Tue Oct 25 18:09:20 2011] [notice] Child 1876: Starting thread to listen on port 80.
[Tue Oct 25 18:16:04 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Tue Oct 25 18:16:46 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Tue Oct 25 18:16:48 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Tue Oct 25 18:16:48 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Tue Oct 25 18:16:56 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Tue Oct 25 18:24:46 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Tue Oct 25 18:24:47 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/favicon.ico
[Tue Oct 25 18:24:50 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/favicon.ico
[Tue Oct 25 18:31:05 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Tue Oct 25 18:31:08 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/favicon.ico
[Tue Oct 25 18:32:10 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Tue Oct 25 18:32:12 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:24:07 2011] [warn] pid file C:/Inet/logs/httpd.pid overwritten – Unclean shutdown of previous Apache run?
[Wed Oct 26 16:24:07 2011] [notice] Apache/2.2.21 (Win32) configured – resuming normal operations
[Wed Oct 26 16:24:07 2011] [notice] Server built: Sep 9 2011 10:26:10
[Wed Oct 26 16:24:07 2011] [notice] Parent: Created child process 1928
[Wed Oct 26 16:24:08 2011] [notice] Child 1928: Child process is running
[Wed Oct 26 16:24:08 2011] [notice] Child 1928: Acquired the start mutex.
[Wed Oct 26 16:24:08 2011] [notice] Child 1928: Starting 64 worker threads.
[Wed Oct 26 16:24:08 2011] [notice] Child 1928: Starting thread to listen on port 80.
[Wed Oct 26 16:35:20 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:35:23 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/favicon.ico
[Wed Oct 26 16:36:16 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/php mysql
[Wed Oct 26 16:36:43 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/php mysql
[Wed Oct 26 16:39:23 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:39:24 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/favicon.ico
[Wed Oct 26 16:40:45 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:40:46 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:40:46 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:40:46 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:40:46 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:40:47 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:40:47 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:40:47 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:40:47 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:44:43 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 16:44:43 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/favicon.ico
[Wed Oct 26 16:49:21 2011] [notice] Parent: Received shutdown signal – Shutting down the server.
[Wed Oct 26 16:49:21 2011] [notice] Child 1928: Exit event signaled. Child process is ending.
[Wed Oct 26 16:49:22 2011] [notice] Child 1928: Released the start mutex
[Wed Oct 26 16:49:23 2011] [notice] Child 1928: All worker threads have exited.
[Wed Oct 26 16:49:23 2011] [notice] Child 1928: Child process is exiting
[Wed Oct 26 16:49:23 2011] [notice] Parent: Child process exited successfully.
[Wed Oct 26 17:21:33 2011] [notice] Apache/2.2.21 (Win32) configured – resuming normal operations
[Wed Oct 26 17:21:33 2011] [notice] Server built: Sep 9 2011 10:26:10
[Wed Oct 26 17:21:33 2011] [notice] Parent: Created child process 236
[Wed Oct 26 17:21:33 2011] [notice] Child 236: Child process is running
[Wed Oct 26 17:21:33 2011] [notice] Child 236: Acquired the start mutex.
[Wed Oct 26 17:21:33 2011] [notice] Child 236: Starting 64 worker threads.
[Wed Oct 26 17:21:34 2011] [notice] Child 236: Starting thread to listen on port 80.
[Wed Oct 26 17:21:35 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 17:22:06 2011] [error] [client 127.0.0.1] client denied by server configuration: C:/Inet/php/php.exe
[Wed Oct 26 17:22:09 2011] [error] [client 127.0.0.1] File does not exist: C:/Inet/htdocs/favicon.ico
[Thu Oct 27 13:36:28 2011] [warn] pid file C:/Inet/logs/httpd.pid overwritten – Unclean shutdown of previous Apache run?
[Thu Oct 27 13:36:28 2011] [notice] Apache/2.2.21 (Win32) configured – resuming normal operations
[Thu Oct 27 13:36:28 2011] [notice] Server built: Sep 9 2011 10:26:10
[Thu Oct 27 13:36:28 2011] [notice] Parent: Created child process 1844
[Thu Oct 27 13:36:28 2011] [notice] Child 1844: Child process is running
[Thu Oct 27 13:36:28 2011] [notice] Child 1844: Acquired the start mutex.
[Thu Oct 27 13:36:28 2011] [notice] Child 1844: Starting 64 worker threads.
[Thu Oct 27 13:36:28 2011] [notice] Child 1844: Starting thread to listen on port 80.

install.log

Installing Apache HTTP 2.0 server with
DomainName = localhost
ServerName = localhost
ServerAdmin = dragan.pavlovic@windowslive.com
ServerPort = 80
ServerSslPort = 80
ServerRoot = C:/Inet
Rewrote C:/Inet/conf/original/extra/httpd-autoindex.conf.in
to C:/Inet/conf/original/extra/httpd-autoindex.conf
Successfully removed C:\Inet\conf\original\extra\httpd-autoindex.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-vhosts.conf.in
to C:/Inet/conf/original/extra/httpd-vhosts.conf
Successfully removed C:\Inet\conf\original\extra\httpd-vhosts.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-default.conf.in
to C:/Inet/conf/original/extra/httpd-default.conf
Successfully removed C:\Inet\conf\original\extra\httpd-default.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-manual.conf.in
to C:/Inet/conf/original/extra/httpd-manual.conf
Successfully removed C:\Inet\conf\original\extra\httpd-manual.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-mpm.conf.in
to C:/Inet/conf/original/extra/httpd-mpm.conf
Successfully removed C:\Inet\conf\original\extra\httpd-mpm.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-info.conf.in
to C:/Inet/conf/original/extra/httpd-info.conf
Successfully removed C:\Inet\conf\original\extra\httpd-info.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-dav.conf.in
to C:/Inet/conf/original/extra/httpd-dav.conf
Successfully removed C:\Inet\conf\original\extra\httpd-dav.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-languages.conf.in
to C:/Inet/conf/original/extra/httpd-languages.conf
Successfully removed C:\Inet\conf\original\extra\httpd-languages.conf.in
Rewrote C:/Inet/conf/original/httpd.conf.in
to C:/Inet/conf/original/httpd.conf
Successfully removed C:\Inet\conf\original\httpd.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-userdir.conf.in
to C:/Inet/conf/original/extra/httpd-userdir.conf
Successfully removed C:\Inet\conf\original\extra\httpd-userdir.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-ssl.conf.in
to C:/Inet/conf/original/extra/httpd-ssl.conf
Successfully removed C:\Inet\conf\original\extra\httpd-ssl.conf.in
Rewrote C:/Inet/conf/original/extra/httpd-multilang-errordoc.conf.in
to C:/Inet/conf/original/extra/httpd-multilang-errordoc.conf
Successfully removed C:\Inet\conf\original\extra\httpd-multilang-errordoc.conf.in
Duplicated C:/Inet/conf/original/magic
to C:/Inet/conf/magic
Duplicated C:/Inet/conf/original/extra/httpd-autoindex.conf
to C:/Inet/conf/extra/httpd-autoindex.conf
Duplicated C:/Inet/conf/original/extra/httpd-vhosts.conf
to C:/Inet/conf/extra/httpd-vhosts.conf
Duplicated C:/Inet/conf/original/extra/httpd-default.conf
to C:/Inet/conf/extra/httpd-default.conf
Duplicated C:/Inet/conf/original/mime.types
to C:/Inet/conf/mime.types
Duplicated C:/Inet/conf/original/charset.conv
to C:/Inet/conf/charset.conv
Duplicated C:/Inet/conf/original/extra/httpd-manual.conf
to C:/Inet/conf/extra/httpd-manual.conf
Duplicated C:/Inet/conf/original/extra/httpd-mpm.conf
to C:/Inet/conf/extra/httpd-mpm.conf
Duplicated C:/Inet/conf/original/extra/httpd-info.conf
to C:/Inet/conf/extra/httpd-info.conf
Duplicated C:/Inet/conf/original/extra/httpd-dav.conf
to C:/Inet/conf/extra/httpd-dav.conf
Duplicated C:/Inet/conf/original/extra/httpd-languages.conf
to C:/Inet/conf/extra/httpd-languages.conf
Duplicated C:/Inet/conf/original/httpd.conf
to C:/Inet/conf/httpd.conf
Duplicated C:/Inet/conf/original/extra/httpd-userdir.conf
to C:/Inet/conf/extra/httpd-userdir.conf
Duplicated C:/Inet/conf/original/extra/httpd-ssl.conf
to C:/Inet/conf/extra/httpd-ssl.conf
Duplicated C:/Inet/conf/original/extra/httpd-multilang-errordoc.conf
to C:/Inet/conf/extra/httpd-multilang-errordoc.conf
Successfully removed C:\Inet\conf\original\installwinconf.awk

Ja covjeku pomazem a on mi na vm-ove stavi xp pa onda gore bez pardona stavi XAMP …

Nego daj mi reci @dragan1201 koje su tvoje namjere sa tom lakrdijom od virtulanih masina

Nije xamp, sve sam instalirao po uputama koje se nalaze na

http://www.webmajstori.net/clanci/programiranje/kako-instalirati-apachephpmysql-na-lokalnom-racunalu-pod-windowsima/191/

To mi treba za završni.


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Webmaster.Ninja