Solved

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

Posted on 2010-11-23
5
833 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
document.write() deleting all existing HTML 5 50
jQuery Toggle & Anchor Links 5 43
Row insertion failed. Array 5 47
Uploading a CSV Data Import via PHP & MySql 3 30
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

860 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