Forum Moderators: coopster

Message Too Old, No Replies

Apache, PHP local testing with Dreamweaver problems

Apache and PHP and Dreamweaver not working locally

         

Peter_McC

4:48 pm on Mar 21, 2007 (gmt 0)

10+ Year Member



Hi, I'm new to Apache and PHP and am finding it difficult to get past the starting blocks! I've been working and testing with PHP files on my hosting server but ideally I'd like to do this locally. I've installed Apache and PHP locally and both are working. The problems I'm having are as follows:

1. I preview a simple index.php page locally (from Dreamweaver) and it works okay. When I click a link on the index.php page to another file (contact.php) in the same local directory I get a 404. I suspect the problem is with how I defined the site in Dreamweaver but have tested variations with no luck. Any ideas?

2. Second problem is like the first, only this time I try to include a 'header.inc.php' file in the index.php from a folder called 'includes'. I get a two fold error as follows:

Warning: include(includes/header.inc.php) [function.include]: failed to open stream: No such file or directory in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\TMPeds49f9i9l.php on line 6

Warning: include() [function.include]: Failed opening 'includes/header.inc.php' for inclusion (include_path='.;C:\php5\pear') in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\TMPeds49f9i9l.php on line 6

I'm going around in circles with this. I've tried numerous sites and help topics that seem to say different things in a language that if I understood in the first place I'D probably be the guy giving the answers.

Any help would be greatly appreciated at this stage. Thanks!

Scally_Ally

5:06 pm on Mar 21, 2007 (gmt 0)

10+ Year Member



It looks like that because you are previewing it from dreamweaver, that a temp file is being created (TMPeds49f9i9l.php) - this temp file then doesnt have the relative links that you need to get the include file.

What it might be an idea doing is downloading an all in one installation of Apache, MySQL and PHP and installing that (something like XAmp). This way you can have your sites running locally, exactly the same as it would remotely, and preview them through your browser keeping all file structures etc intact.

It took a load of the headache out of it for me.

Ally

Peter_McC

10:35 am on Mar 22, 2007 (gmt 0)

10+ Year Member



Thanks Ally. As a result of using a single installation for all three, did you still have to create virtual directories yourself or does that work automatticly?

My problem could be as simple as having [localhost...] in the remote directory in Dreamweaver instead of something else.

Do you preview from Dreamweaver, was that problem solved with the single point installation of all three?

Scally_Ally

10:41 am on Mar 22, 2007 (gmt 0)

10+ Year Member



I never really test from within dreamweaver cause its just as easy to set up the installation on your own computer.
You can create multiple directories for different sites.
It is good cause it gives you a true representation of what it will look like on the server where you will be hosting - keeping all directory structure - all you have to do then is copy the files across and re-create your database.

Ally

Peter_McC

11:28 am on Mar 22, 2007 (gmt 0)

10+ Year Member



Cheers, sounds like it's worth a try. My heart is broken trying to set this up.

Scally_Ally

12:20 pm on Mar 22, 2007 (gmt 0)

10+ Year Member



try XAmp

jatar_k

1:25 pm on Mar 22, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld Peter_McC,

there are a couple threads in the PHP Library [webmasterworld.com] that may help as well

Installing a new web server: Apache2, PHP5, MySQL4 and PHPmyAdmin. [webmasterworld.com]
Installing PHP5 Under Windows XP and Apache [webmasterworld.com]

Peter_McC

2:30 pm on Mar 22, 2007 (gmt 0)

10+ Year Member



Thanks for all the help! I'll try Xampp.

Peter_McC

2:47 pm on Mar 30, 2007 (gmt 0)

10+ Year Member



Just a quick update.

I installed Xampp which was easy to do. I've also been able to edit one of my PHP sites locally which saves me so much time. I'm still having problems setting up the virtual host but expect to have that cracked soon enough. It seems the more attempts I make at setting up apache the more I begin to understand the lingo too which is a pleasent side effect :) Thanks for all your help!

coopster

2:36 pm on Mar 31, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It seems the more attempts I make at setting up apache the more I begin to understand the lingo too which is a pleasent side effect

Necessary, if you ask me! The more you know about the HTTP server you are using the easier it becomes to resolve issues. The pleasant side effect there is that you also begin to analyze and design code in the light of that knowledge.

Nice work.