How to put php script outside root?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

sendy
New php-forum User
New php-forum User
Posts: 9
Joined: Thu Oct 25, 2012 9:47 pm

How to put php script outside root?

Postby sendy » Mon Nov 26, 2012 11:29 pm

I have searched google and didnt find any good explanation , i dont know if my keywords were wrong or what, but here's the question:

how to put php script outside root?
-assume i have root C:/xampp/htdocs
-i put my html/php to display homepage in htdocs/home.php
-then i put my database connection script outside htdocs, i put it in C:/xampp/database/mysqli_connect.php
-after that i use :

Code: Select all

 include("../database/mysqli_connect.php")
in the htdocs/home.php, but i got errors saying : php_network_getaddresses: getaddrinfo failed: No such host is known

how to do this correctly?

Sendy Halim

sendy
New php-forum User
New php-forum User
Posts: 9
Joined: Thu Oct 25, 2012 9:47 pm

Re: How to put php script outside root?

Postby sendy » Mon Nov 26, 2012 11:46 pm

err nevermind i put it in the wrong directory, it works now :D


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest