Base Path

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Base Path

Post by kinggori »

Hello everyone,

I’m new here and I had a nooby question and since there are a lot of php experts here I hope someone can help me out.

I’m trying to install a php script on my domain. My domain name is hosted by dreamhost.

During installation of the script it asks me to enter the
Base Path (ends with /)
So I enter
/home/username/domainname/

Where I enter my user name and domain name instead. It says that path is wrong. I tried all possible combinations and I’m just sick and tired. Anyone have any idea what I’m doing wrong?

I would really appreciate any help.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What folder are you installing to? You can try throwing down a path of '/' for your server root path, or for a subfolder, you can try '/subfolder/'. Not sure if it will work, but it is worth a shot.
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

Everah wrote:What folder are you installing to? You can try throwing down a path of '/' for your server root path, or for a subfolder, you can try '/subfolder/'. Not sure if it will work, but it is worth a shot.
Thanks for your reply Everah,

I'm trying to install it to my main domain so there is no subfolder
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Give '/' a shot and see what that does.
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

Everah wrote:Give '/' a shot and see what that does.
doesn't work :cry:
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Next two shots... first, '', second './'. Otherwise, I would need to see the installation code to see what it really wants.
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

Everah wrote:Next two shots... first, '', second './'. Otherwise, I would need to see the installation code to see what it really wants.

Still doesn't work Everah... did you get my pm?
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

Shall I posy my domain info here?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Upload a phpinfo() page and see what the output of the $_SERVER['SCRIPT_PATH'] is.

Code: Select all

<?php
phpinfo();
?>
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

kinggori wrote:Still doesn't work Everah... did you get my pm?
Yes. If possible, let's keep the thread going right here. If there is sensitive information that you do not want to post **** it out.
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

I added php-info.php as Evarah suggested.

I found that the DOCUMENT_ROOT (which i presume is the base path) is:
/home/torpoder/***.com

I tried that and it didn't work


here it is the php-info.php file:
http://***.com/php-info.php

Here is the script I'm running:
http://***.com/install/install.php
Last edited by kinggori on Mon May 22, 2006 6:24 am, edited 4 times in total.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You might want to take the links down. Are all the files that you are needed for this thing to run in your base path? I noticed that when I got through to the point where you are having a problem and it is saying that the files are not in that specified path. If the files are there, there may be a problem with the script installer.

PS I noticed that the nicecoder.com website is down. I wonder if maybe they are a tad shady? :cry:
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

Everah wrote:You might want to take the links down. Are all the files that you are needed for this thing to run in your base path? I noticed that when I got through to the point where you are having a problem and it is saying that the files are not in that specified path. If the files are there, there may be a problem with the script installer.

PS I noticed that the nicecoder.com website is down. I wonder if maybe they are a tad shady? :cry:
- It checks for the file called "indexu_exe.idf" and this file and all other files are in the base path. I double checked this several times. Here is even the link to the file:
http://****.com/indexu_exe.idf

- nicecoder is well known. It's just a coincidence that their website is down. Unless the code trys contacting the website somehow but I don't think that's the problem here.

- Here is the part of the code that does the checking:

Code: Select all

function CheckForm() {
  global $base_path, $site_url, $dbUsername, $dbPassword, $dbHostname, $dbName,
         $HTTP_POST_VARS;
  // check database
  $found_db = true;
  @MYSQL_CONNECT($dbHostname,$dbUsername,$dbPassword)
    OR $err = "Unable to connect to database";
  @mysql_select_db("$dbName")
    or $err = "Unable to select database";
  if(!empty($err)) $found_db = false;

  // check executable files inside base_path
  $handle = @opendir($HTTP_POST_VARS["base_path"]);
  while ($file = @readdir($handle)) {
    if ($file=="indexu_exe.idf") { $found_exe=true; }
  }
  @closedir($handle);

  if ($found_db && !$found_exe) {
    $err= "Base path does not contain Indexu files";
  }
  
  return $err;
}
Last edited by kinggori on Mon May 22, 2006 6:25 am, edited 1 time in total.
kinggori
Forum Newbie
Posts: 11
Joined: Sun May 21, 2006 7:49 pm

Post by kinggori »

sorry for spamming the thread, but i think this part might be important too. This is where the input is read:

Code: Select all

function ShowForm() {
  global $message_step5, $pf, $HTTP_SERVER_VARS, $PHP_SELF, $error_message,
         $base_path, $site_url, $dbUsername, $dbPassword, $dbHostname, $dbName, $site_name;
  
  if(empty($pf)) {
    $path = $HTTP_SERVER_VARS["PATH_TRANSLATED"];
    if(empty($path)) { $path = getenv("PATH_TRANSLATED"); }
    $path = stripslashes($path);
    $path = str_replace("\\","/",$path);
    $base_path = str_replace('install','',dirname($path));
    
    $host = $HTTP_SERVER_VARS["HTTP_HOST"];
    if(empty($host)) { $path = getenv("HTTP_HOST"); }
    $ref = str_replace('/install/install.php','',"http://".$host.$PHP_SELF);
    $site_url = $ref;
    
    $dbHostname = 'localhost';
  }
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

kinggori wrote:

Code: Select all

function CheckForm() {
  global $base_path, $site_url, $dbUsername, $dbPassword, $dbHostname, $dbName,
         $HTTP_POST_VARS;
  // check database
  $found_db = true;
  @MYSQL_CONNECT($dbHostname,$dbUsername,$dbPassword)
    OR $err = "Unable to connect to database";
  @mysql_select_db("$dbName")
    or $err = "Unable to select database";
  if(!empty($err)) $found_db = false;

  // check executable files inside base_path
  $handle = @opendir($HTTP_POST_VARS["base_path"]);
  while ($file = @readdir($handle)) {
    if ($file=="indexu_exe.idf") { $found_exe=true; }
  }
  @closedir($handle);

  if ($found_db && !$found_exe) {
    $err= "Base path does not contain Indexu files";
  }
  
  return $err;
}
Change this part...

Code: Select all

// check executable files inside base_path
  $handle = @opendir($HTTP_POST_VARS["base_path"]);
  while ($file = @readdir($handle)) {
    if ($file=="indexu_exe.idf") { $found_exe=true; }
  }
  @closedir($handle);
... to this ...

Code: Select all

// check executable files inside base_path
  if (!$handle = opendir($HTTP_POST_VARS["base_path"]))
  {
    $err = "Base path " . $_POST['base_path']  " was not able to be opened...<br />";
  }
  while ($file = readdir($handle)) {
    echo $file . "...<br />";
    if ($file=="indexu_exe.idf") { $found_exe=true; }
  }
  closedir($handle);
This is going to echo out quite a bit of information about your files and system, so once it is up, test it and see what might be getting returned by the app. Once you get the info, change the code back to the original.
Post Reply