Solved

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

Posted on 2010-11-23
5
827 Views
Last Modified: 2012-05-10
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

0
Comment
Question by:Kelvin81
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:Kent W
ID: 34200309
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.
0
 
LVL 8

Author Comment

by:Kelvin81
ID: 34200593
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).
0
 
LVL 12

Accepted Solution

by:
Kent W earned 500 total points
ID: 34200699
That will work for html, but not php.  If you have IIS with PHP installed an on, then you would just put the *.php page in your document root (usually C:\inetpup\wwwroot), but the properties of your default website will show for sure where the docroot is.
Then, just open up a broswer and go to, say, if your page is named "index.php",
http://localhost/index.php



0
 
LVL 8

Author Comment

by:Kelvin81
ID: 34205896
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
0
 
LVL 12

Expert Comment

by:Kent W
ID: 34207727
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 :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now