View Full Version : ANY small php script.
Morgoth
11-25-2002, 07:10 PM
Hello,
I am running a server that doesn't have php support, I am also very new to php, and I would like a script that I can use that will tell me if I have support for PHP after I install the plugin.
Something simple that is known to work.
Now, I saw a script like:
$myvar = "Hello World!";
for ($i=0; $i<10; $i++) {
echo $myvar."\n";
}
In the FAQS section, but I am new to PHP and I would like to know if that is all I need. Should that work if I stick it in a normal php file made with notepad?
Thank you.
Nightfire
11-25-2002, 07:22 PM
So you're just wanting to know if php is working?
Use this
<?php phpinfo(); ?>
shouldn't that be
<?php
echo phpinfo();
?>
?
Morgoth
11-25-2002, 07:31 PM
Well, which one?
Please test this before posting. I need just one that will work with no errors and faults.
Thank you again.
Spookster
11-25-2002, 07:50 PM
Originally posted by Ökii
shouldn't that be
<?php
echo phpinfo();
?>
?
The phpinfo() function does not return something that you need to echo. The function itself contains all the necessary print commands to echo the information it generates to the browser page.
Morgoth
11-25-2002, 07:53 PM
Originally posted by Spookster
The phpinfo() function does not return something that you need to echo. The function itself contains all the necessary print commands to echo the information it generates to the browser page.
So:
<?php phpinfo(); ?>
Is good?
ConfusedOfLife
11-25-2002, 08:08 PM
It's almost cool! :D
Spookster
11-25-2002, 09:33 PM
Originally posted by ConfusedOfLife
It's almost cool! :D
No!!! It's very cool!!! :D
As for you Morgoth, yes that is all you need. Just create a php file and name it whatever you like. I usually name it phpinfo.php as it is easy to remember what it is then simply put
<?php phpinfo(); ?>
in it as nightfire said. Load it into the browser and you should see something just like this:
http://www.designqueue.com/phpinfo.php
That is the one I put on my server.
Morgoth
11-25-2002, 10:20 PM
Ok, thank you all!
JVRudnick
12-10-2002, 03:23 PM
hi all...
okay..found this thread, and copied the script exactly; saved same as phpTester.php and put it into the www folder in the phpDev folder. Apache says it's running...dbl/clicked on the file and it opens up my code editor app, EditPlus+ and nothings in the code window -- hmmm..
so i then resaved same in same place and called it phpTester.html....and then dbl/clicked it and it opens up a blank IE window -- hmm...
guys, I need help here. I have NO IDEA on what I'm doing (in asp i just save the file as a .asp in my code editor app, put it into wwwroot and then it runs fine...but this aint ms land?)
can someone give me a STEP-BY-STEP to show a php file on my dev box?
Jim Rudnick
Spookster
12-10-2002, 04:04 PM
Originally posted by JVRudnick
hi all...
okay..found this thread, and copied the script exactly; saved same as phpTester.php and put it into the www folder in the phpDev folder. Apache says it's running...dbl/clicked on the file and it opens up my code editor app, EditPlus+ and nothings in the code window -- hmmm..
so i then resaved same in same place and called it phpTester.html....and then dbl/clicked it and it opens up a blank IE window -- hmm...
guys, I need help here. I have NO IDEA on what I'm doing (in asp i just save the file as a .asp in my code editor app, put it into wwwroot and then it runs fine...but this aint ms land?)
can someone give me a STEP-BY-STEP to show a php file on my dev box?
Jim Rudnick
If all you have in your phpTester.php file is this:
<?php phpinfo(); ?>
Then make sure you have PHPDEV running.
JVRudnick
12-10-2002, 04:23 PM
ummm...and how do I do that? sorry, but I dont' understand...ASP and IIS I understand...but not php?
Jim
Spookster
12-10-2002, 04:44 PM
Well depending on which version of PHPDEV you have then their will either be a GUI that comes with it with a button that says Start PHPDEV or if it is an older version there will be a batch file that starts it up.
Originally posted by JVRudnick
Apache says it's running...dbl/clicked on the file and it opens up my code editor app, EditPlus+ and nothings in the code window -- hmmm..
You cannot [easily] get a .php file to be parsed simply by double clicking it. You would need to surf to it in a web browser.
Try navigating to
http://localhost/phpTester.php
Spookster
12-10-2002, 05:04 PM
Originally posted by Ökii
You cannot [easily] get a .php file to be parsed simply by double clicking it. You would need to surf to it in a web browser.
Try navigating to
http://localhost/phpTester.php
Good catch. Hadn't noticed he said dbl/clicked. :)
Yes you must run the .php files through the webserver as they need to be parsed by the php engine.
I would suggest not leaving phpinfo on your server. It gives out rather a lot of information that can be useful if your security isn't perfect ...
It's a great function, but be careful about letting the results into the wrong hands.
JVRudnick
12-10-2002, 06:51 PM
guys.... I mean REAL NEWBIE here...
I've already got IIS running my asp via the C:\Inetpub\wwwroot folder items..
So when I load that page C:\phpdev\www\phpTester.php...
What I get is a page in IE6 that shows me this address -- http://localhost/localstart.asp and content that tells me about IIS5...
I DO NOT GET that phpTester.php file..ie it is not served to the browser...
Help here guys? how do I see a page in IE that is php?
Jim
Morgoth
12-10-2002, 08:16 PM
JVRudnick, you installed PHP right?
IIS doesn't come with that server extention.
Spookster
12-10-2002, 08:22 PM
You cannot run both Apache and IIS at the same time unless they are designated to user different ports.
Shut down IIS. Start PHPDEV(which starts apache and php) and then open the page in your browser like so:
http://localhost/phpTester.php
Morgoth
12-10-2002, 08:41 PM
Unless you just want apache, you can install ASP extentions on it.
Or if you want IIS you can install PHP on it.
One or the other.
++
and (next time) rather than leaping in and using someone elses thread to ask your question, you might consider starting a brand new one.
Makes it easier for us peeps when we try to find certain threads.
JVRudnick
12-10-2002, 09:20 PM
Hi...
umm...okay. shutdown IIS, then went to Start > Programs > and started up phpdev_2k_XP_NT.
this then opens up an IE window, and i see a listing of a whole bunch of files there in this localhost dir... including that phpTester.php file. when I click that one, I get a long scrolling page with the page title that says phpInfo() and the page says "PHP Version 4.2.3" up at the top in a blue box..followed by lotsa other boxes too full of other stuff (god, I sound like a 10 year old).
anyways, this means (yes?) that php is running....right?
if so, can someone tell me how to say ask for the time on a php page...in ASP it'd be <%=nDate()%>...but what is it in php?
say, what does php stand for anyways?
wait...also how do i look at the source for that code in IE..or rather, what do you folks use for a code editor for php dev? and how do you 'stitch' it in so that it's seamless when viewing your code in IE on the dev box???
jim
Nightfire
12-10-2002, 09:57 PM
You should know you can't view-source of a serverside language with you knowing asp. Edit pages exactly the same you do with asp - with a text editor.
See http://www.php.net/time for the time
http://www.php.net - get the manual from here too and your answer to your "what is php" question is on the index page
Spookster
12-10-2002, 10:20 PM
This thread has already served its purpose in answering the question of what small script to use to see if php is running so I will close it down.
If you have other PHP questions create a seperate thread for them.
Also check out the php manual at www.php.net as that will aid in answering the many small questions you may have. Also you can use the search feature of our forums. If you don't find answers using our search feature then please feel free to create a topic for it. :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.