kingrichard2005
kingrichard2005

Reputation: 7289

Eclipse PHP development environment setup

I'm trying to setup Eclipse for PHP development on my Windowx box. I've got PDT, Apache and PHP installed and was using this guide as a reference. Everything works fine except when I preview the sample web page I see the entire plain text file instead of the expected PHP generated code. For example, the file I have contains the following:

<?php

echo "Hello World!"; 

?>

When I run it, I expect to see

Hello World!

But instead I see the entire file as plain text as shown in the below screen cap

enter image description here

I'm not sure if there's something wrong with the syntax or configuration. I'd also like to be able to debug PHP web apps through Eclipse. If there are better alternatives to setting up PHP development with debugging, I'm open to suggestions. Thanks in advance.

UPDATE:

@Neal - The Apache server is running. I know when I was installing PHP, I never got the prompt to add it to my Apache server instance as the tutorial indicated. If that's the case, then no. Is there a way I can add PHP to the Apache server manually? Thanks.

@ontaria_ - I'll try reinstalling PHP using the zip file, I was using the MSI installer instead and according the the readme it should've configured itself for Apache automatically.

UPDATE 2:

Thanks all for your help. I had another look and it turns out I was using the Non-thread safe installer, I downloaded and ran the Thread Safe installer and saw the option to include the modules for Apache. Tested and worked as expected, thanks again for your help.

Upvotes: 0

Views: 741

Answers (1)

Sean Walsh
Sean Walsh

Reputation: 8354

Check your httpd.conf and ensure that you are loading the module and pointing towards the ini file:

LoadModule php5_module "/path/to/php/php5apache2_2.dll"
PHPIniDir "/path/to/php"
AddType application/x-httpd-php .php

If those lines are there, ensure that the files actually exist in those folders. If you have to make changes, make sure you restart Apache.

Please note that these lines may or may not(probably not) be one after another like they are in my example, so make sure to search for them.

Upvotes: 1

Related Questions