Link to home
Start Free TrialLog in
Avatar of Kelvin81
Kelvin81

asked on

Setting up PHP. Notepad++ does not recognize <?php

Hi,

I am a COMPLETE beginner.  I've read a tutorial or two and am trying to set up my PHP environment to work through some of these examples.

I've downloaded/installed notepad++ as an editor.  I've installed version PHP 5.3 (5.3.3) from php.net with the IISCgi webserver option.

While I have no clue what I'm doing, I was hoping that I set it up correctly.  

I'm new in general to web development and was hoping someone could help me out with what I'm doing wrong.  Currently when I run it, I just get a blank page, unless I put some html outside of the <?php .. ?> tags.

Attached is what I am trying to run to be able to test these in firefox.

Thanks again for helping me get on the road.  

Regards,
Kelvin
<html>
<head>

<title>Kelvin.php</title>

</head>
<body>

<?php
Test
$link = mysql_connect('<server>', '<user>', '<password>');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);


echo "Test";
?>


</body>

</html>

Open in new window

Avatar of Kent W
Kent W
Flag of United States of America image

How are you  "running it"?  You should be copying this to your php-enabled web server and hitting it as a web page vi port 80 (defaultly).  I have a funny feeling you are just double clicking on the .php file directly in your file browser :)
If not, and you are viewing the php via a web call, there are several thing that could be wrong.
Foremost, was php installed correctly?  second try just doing a simple echo "Hello World" as a test before doing something larger, like a mysql connection.
But, since you say you can't "run it in firefox", I"m thinking you are probably just double clicking your fresh php file and opening in the default browser.  That won't work.  You need to send it through the web server.
If that's not what you are doing, holla back.
Avatar of Kelvin81
Kelvin81

ASKER

sort of and almost.

I am using notepad++ which has the "Launch in Firefox" option for debugging.  I thought it would work but apparently not.  

How would I go about sending it through an IIS instance that is on my local machine?   (Sorry for how basic my question is).
ASKER CERTIFIED SOLUTION
Avatar of Kent W
Kent W
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry for the long delay.

I'm sure i'll be putting up questions about how to set up IIS to work with PHP.  So far all I get is badly formed header error in IIS.

(I don't know if it would be easier to scrap it and install apache).

Regards,
Kelvin
PHP and IIS, although it works pretty well when setup correctly, it has it's issues, especially on how and which way to set it up.
I would suggest using apache, or if you have an old machine you can throw linux on...even a cheap VPS, that would give you more of a real developer experience, as most php apps run on the LAMP stack anyway.
Glad I could help :)