XAMMP - Difficulties with dynamic links database

Problems with the Windows version of XAMPP, questions, comments, and anything related.

XAMMP - Difficulties with dynamic links database

Postby hermanG » 07. November 2011 22:18

Firstly, thanks for the forum. I'm new to offline servers and XAMPP, so I'm not very intuitive in this area. My real goal here is to setup an offline venue to work on our commerce website, so as not to "break" the live version.

Here's where I've been so far: I've downloaded XAMPP (a number of times, while trying to solve issues), I've installed my site in the htdocs directory a number of different ways (as best as I can make out from the different sets of instrustions available), I've copied the db into MySql and had it somewhat working.

The problems have been:
My site linking back to the live site directly. I DID have this stopped at one point, but it's back on a newer install and I can't get it broken of that this time.

The other problem was that the dynamic links wouldn't work correctly. I don't THINK it was a db problem, b/c I DID get the index page (which calls a lot of other pageloads and files, some from the db, I suspect) to finally work. BUT... EVERY link from the homepage out was broken w/a 404 Object not found. I looked in the error logs, but couldn't make much sense of those b/c they listed a file and said it didn't exist, but it doesn't really exist in the live site, either, but that works.

Please help. I'd be happy to supply any info you need to help. I just don't want to clutter this post with useless info (I've accumulated a TON of that since I've been trying to get this working for days and days).

Thanks a lot,
H
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Re: XAMMP - Difficulties with dynamic links database

Postby hermanG » 07. November 2011 22:37

XAMPP 1.7.7 on Windows 7, btw. Sorry I forgot to mention that. Also, I'm great with whichever problems we can solve. I have an instance of my website in htdocs that is currently stuck on linking out to my live site, and I also have one that isn't working b/c there is no db currently installed. (It was stripped out during the last re-install of XAMPP). That one was working so far as the homepage only when the db was present. --- Thanks, again.
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Re: XAMMP - Difficulties with dynamic links database

Postby Sharley » 07. November 2011 22:44

Linking out usually means that the links in your script have a url (http://yourlinkedsite.html/myfile) instead of a relative path (/myfolder/myfile) so your script should have a configuration page where the paths are set.

The other problem with a DB would need a database created using phpMyAdmin in XAMPP.
Best to export your database as an SQL file from where ever you have the original database and then import it using phpMyAdmin in your XAMPP local installation.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: XAMMP - Difficulties with dynamic links database

Postby Altrea » 07. November 2011 22:47

Hi hermanG (don't have the time for a small welcome!?)

Please update your operating system information in your forum profile to something more specific. It can make a differnet for support whether you have a Windows 7 Home Premium x86 (32Bit) or a Windows 7 Ultimate SP1 x64 (64Bit).

hermanG wrote:My site linking back to the live site directly.

What does that mean? Which links do you mean?
The information to which direction your links are showing are not provided by apache but from your application. So the issue have to be somewhere in your application. It can be hardcoded in your script sourcefiles, or in your database, or your .htaccess files.

hermanG wrote:The other problem was that the dynamic links wouldn't work correctly.

What do you mean by dynamic links? Where and how do you use them with xampp?

hermanG wrote:I looked in the error logs, but couldn't make much sense of those b/c they listed a file and said it didn't exist, but it doesn't really exist in the live site, either, but that works.

Not much information to give you any hint. We don't know your application, the links or the error lines in your logs. Giving you any help is really difficult.

hermanG wrote:Please help. I'd be happy to supply any info you need to help. I just don't want to clutter this post with useless info (I've accumulated a TON of that since I've been trying to get this working for days and days).


much much more information please. Give all information which maybe can be useful. You have problems with links, so the minimum information would be, what url you type in your browser, which error line you get, if you use any url manipulating techniques like mod_rewrite, etc etc.

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: XAMMP - Difficulties with dynamic links database

Postby hermanG » 07. November 2011 23:14

Thanks for your replies. I've updated my profile to show Win 7 Pro (64 bit).

Sharley's - The site (as developed by our programmer) links out relative. So far I've found 3 or 4 files at least that seem to have some bearing on that. There is a codeigniter.php, a config.php, a Config.php, several hundred thousand (not literally) index.php files, a constants, and a common.php. The following is from the constants.php file.

Code: Select all
//this section was from when they developed offline. I changed the line you see with XAMPP in it
//I've defined IS_LIVE as false just above this in the same file
if(IS_LIVE === true)
{
   define('ABS_PATH', '/home/bc5/public_html/');
}
else
{
define('ABS_PATH', "C:/xampp/htdocs/public_html/"); //this is the folder that has my main index.php file in it.


Thanks, Altrea for the straightforward confirmation I think I heard that the problem with linking out would be in my app. That can narrow it down at least.

Right now, when I type "localhost" in my address bar, I get the htdocs folder, which I can then click on either of the instances I have of my site. When I click on the "public_html" one, then it takes me to the live site on the web. (I can tell b/c I changed one of my graphics on the homepage in the local copy, which worked before to differentiate, as well as the address in the address bar).

What do I mean by dynamic links... I mean that our site (apparently) builds the URL dynamically to call a page shell and then fill it with db data when a user clicks on a link. In the instance when I had the homepage working, I could click on one of the links from that page on the live site OR the local site and it would come up with the same URL... only on the local site I get an "Object not found. Error 404" response. The ACTUAL file it's calling for in that URL doesn't really exist on the live server, so I'm a bit fuzzy on how that works.

p.s. Don't know why my code is all in green. Sorry.
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Re: XAMMP - Difficulties with dynamic links database

Postby hermanG » 07. November 2011 23:48

Below is another one I changed. This is from the Config.php file in my application.

Code: Select all
function __construct()
   {
      $this->config =& get_config();
      log_message('debug', "Config Class Initialized");
      // Set the base_url automatically if none was provided
      if ($this->config['base_url'] == '')
      {
         if(isset($_SERVER['HTTP_HOST']))
         {
            $base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
            $base_url .= '://'. $_SERVER['HTTP_HOST'];
            $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
         }
         else
         {
            $base_url = 'http://localhost/public_html/';
            //This is the line I changed. I set it to the one above^ --$base_url = 'http://localhost/';
         }
         $this->set_item('base_url', $base_url);
      }
   }

I'll keep going with things I've already done. If it becomes counter-productive, let me know.
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Re: XAMMP - Difficulties with dynamic links database

Postby hermanG » 08. November 2011 00:06

Here's one from the config.php file.

Code: Select all
if(IS_LIVE === true)
{
   $config['uri_protocol']   = 'ORIG_PATH_INFO';
}
else
{
$config['uri_protocol']   = 'AUTO';
//$config['uri_protocol']   = 'ORIG_PATH_INFO';
}


I've changed the last line to 'AUTO' in the line above. I think this helped it to work on one of my other tries. Doesn't seem to be this time, so I don't know if this was a necessary/advisable or not.
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Re: XAMMP - Difficulties with dynamic links database

Postby Altrea » 08. November 2011 00:07

hermanG wrote:
Code: Select all
[...]
      if ($this->config['base_url'] == '')
[...]

Why not simply set the base_url in the config instead of change several files hardcoded?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: XAMMP - Difficulties with dynamic links database

Postby hermanG » 08. November 2011 00:21

B/C I really don't know what all the original programming is accomplishing. I have done that sometimes. It's kind of all Greek to me. To illustrate how I code:

I see a guy in a French restaurant who says to the waiter, "Blah-soise blah blahndez blah blah." Then the waiter brings him a delicious-looking cheesburger.

Now, I will say to the waiter, "Blah-soise blah blahndez blah blah," and HOPE to get a delicious cheeseburger. This, KNOWING full well, that I might have said:
"Please bring me a delicious cheesburger."
OR
"Hi, Francois! I'll have the usual."
OR
"Nice to see you [my future brother-in-law]. Your sister was great last night."

What happens mostly (50% of the time) is, I get a cheeseburger. 30% of the time I get SOMEthing that I want, then I try to augment my order. 18% of the time the waiter gets mad and curses at me in French. Of course, I don't understand him (or his error codes), but I am poignantly aware that I am not getting my cheeseburger. (Yeah. I can do math. The other 2% of the time I don't know what the heck happened.)
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Re: XAMMP - Difficulties with dynamic links database

Postby Altrea » 08. November 2011 00:53

Well, it's your application...
but if the original programmer gives you the possibility to change configuration variables at a central place, i don't see any reason not to use it.
I don't think that you will better unbderstand the code, if you change several things at several points of the code. You should take your time to analyse the sourcecode in a structured way.

That sounds like "well, i don't have any idea how to fly a plane, but for now i shift this switch and that switch and push that funny red blinking button and maybe i can land it then" :D
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: XAMMP - Difficulties with dynamic links database

Postby hermanG » 08. November 2011 01:31

That sounds like "well, i don't have any idea how to fly a plane, but for now i shift this switch and that switch and push that funny red blinking button and maybe i can land it then" :D


Yes! It's EXACTLY like that. Rather nervewracking. I have been (thus far) rather forced to imitate the pilot I saw on TV once, since I don't know that I could simply pull back on the other flapper instead.

I like the sounds of just setting the variables, as you mentioned. I have some fears that they may have set things up complicatedly enough to need those settings as variables later on, but, at the moment, that seems like wondering what to have for breakfast the day after I land this plane.

Would you be so kind as to let me know what the key configuration variables I should be looking for are, where to find them (typically) and what I should set them to? If it is possible to give general help in that way, that would be great. As absurd as my approach is (I give you that), I really don't have the luxury of learning php or local servers top-to-bottom right now. Nor do I really see why that should be necessary to just get a site up on a local server. If it IS... I'll have to come up with a different approach, I guess.

Thanks for the feedback to date.
g
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Re: XAMMP - Difficulties with dynamic links database

Postby Altrea » 08. November 2011 01:51

hermanG wrote:Would you be so kind as to let me know what the key configuration variables I should be looking for are, where to find them (typically) and what I should set them to?

i can't because i don't know your application. Maybe i could guess if you show us the configuration file (which is very common named config.php, config.inc.php, configuration.php, settings.php or something like this obvious).
But "base_url" is very common the name of the variable where the base url of the application can be configured :wink:

hermanG wrote:I really don't have the luxury of learning php or local servers top-to-bottom right now.

Will you ever have the time? Some things in life take some time to handle it.

hermanG wrote:Nor do I really see why that should be necessary to just get a site up on a local server.

Well, because you change things on many differnet points of that application and you don't have any idea why, if the changes are needed and what the consequences of the changes are. Your application maybe will run locally then, but you have to revert back all the changes to get it working live again.

But like i said, it is your environment and your application. I make a lot of money in my life to make things working again after other people have acted like you. So you're very welcome :D
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11926
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: XAMMP - Difficulties with dynamic links database

Postby Sharley » 08. November 2011 02:05

Herman, you're looking for a url link not a path if you are still going to the Internet from your local web site.

You really need to search inside all your web site files for a url to your outside web site and a useful program to do that is His Grepship, read all about it here and then download a 30 day trial and see if you can locate the outside url:
http://members.optusnet.com.au/~slgdouglas/Grepship/


Just on the odd chance that a .htaccess file is redirecting you to the outside web site, try this.

Locate a .htaccess file in the root folder of your web site (the folder with your web site files) then move (drag) that file onto your desktop effectively removing it from the equation.

Now try your web site again locally and see if it still tries to head off to your Internet web site.

If it does then you know it is not the .htaccess file and you can drag it back into place.

If you don't go to your Internet site then you know it is the .htaccess content that is the culprit.

You could then locate in the content the offending rewrite rule or redirect rule and comment it out.

Just one process of elimination.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: XAMMP - Difficulties with dynamic links database

Postby hermanG » 08. November 2011 17:05

Thanks for all of your replies, again.

Sharley hit on something very helpful. The .htaccess was the culprit for rewriting the addy, I believe.

Now, I am hoping to be able to get somewhere when I get my db shoved back in here locally. As you've concluded, I'm sure, I fumbled about to do that before.

I would like to do it right this time. I've come across a dozen sets of instructions on installing XAMPP, but I've not seen any to get the db in that I could make much sense of. (Might be me, I suppose.)

Anyway, can you guys give me the bullet points of that? Where and how, given that my application rests in XAMPP/htdocs/public_html directory.

Much appreciated,
H
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Re: XAMMP - Difficulties with dynamic links database

Postby hermanG » 08. November 2011 19:16

How do I get the db imported and set up? Is it in the phpMyAdmin page? Does it matter where the db files are located for my local site to connect to it?

Should I add ("Create new database") the db, named the same as my live site (my live site's db is named "mysite5_mysiteLIVE")?
Which option under "Collate" (what determines that)?
And, THEN try to import my db, which I exported from my live site host (mysite5_mysiteLIVE.sql.gz) into that newly created one?

OR

Is there some way to just import/restore it directly?

I know I'll have to set the passwords and such in my application files. I believe I can do that.

Thanks,
H
hermanG
 
Posts: 16
Joined: 03. November 2011 16:12
Operating System: Windows 7 Professional (64 bit

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 155 guests