Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

PHP is setup properly but still doesn't work


  • Please log in to reply
8 replies to this topic

#1 Nathan2508

Nathan2508

  • Members
  • 64 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Chicago, IL
  • Local time:11:02 AM

Posted 14 May 2010 - 09:49 PM

I am running IIS7 with PHP

I created the file info.php and when I run http://localhost/info.php it shows up with the version number and all that good stuff.

None of my .php files will work on the local server though so after some searches I found that I should turn register_globals on. This didn't work. Any help would be appreciated!


Nathan

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:02 AM

Posted 14 May 2010 - 10:28 PM

What does "doesn't work' mean? Are you getting error messages?

#3 Nathan2508

Nathan2508
  • Topic Starter

  • Members
  • 64 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Chicago, IL
  • Local time:11:02 AM

Posted 15 May 2010 - 07:25 AM

No error messages. I'm learning PHP and going through some examples that can be downloaded for my textbook.

In this first example you fill out an HTML form. Once you submit it it calls a .php file to save each answer to variables and then output a confirmation page. The echo command on the confirmation page displays like this though:

'; echo 'You were abducted ' . $when_it_happened; echo ' and were gone for ' . $how_long . '
'; echo 'Number of aliens: ' . $how_many . '
'; echo 'Describe them: ' . $alien_description . '
'; echo 'The aliens did this: ' . $what_they_did . '
'; echo 'Was Fang there? ' . $fang_spotted . '
'; echo 'Other comments: ' . $other . '
'; echo 'Your email address is ' . $email; ?>

It doesn't output the php code that assigns the variables, only the echo commands without actually executing the code.


Nathan

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:02 AM

Posted 15 May 2010 - 07:37 AM

Hard to say without seeing your actual code. Looks to me like a typo somewhere.

#5 Nathan2508

Nathan2508
  • Topic Starter

  • Members
  • 64 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Chicago, IL
  • Local time:11:02 AM

Posted 15 May 2010 - 01:31 PM

This is directly from the textbook so I don't think there are typos. All the variable names at the top are 100% correct. It doesn't send any type of e-mail when I change $to = "myemail" either. For some reason it's not outputting anything from that first echo line.

<?php
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$when_it_happened = $_POST['whenithappened'];
$how_long = $_POST['howlong'];
$how_many = $_POST['howmany'];
$alien_description = $_POST['aliendescription'];
$what_they_did = $_POST['whattheydid'];
$fang_spotted = $_POST['fangspotted'];
$email = $_POST['email'];
$other = $_POST['other'];

$to = 'test@test.com';
$subject = 'Aliens Abducted Me - Abduction Report';
$msg = "$name was abducted $when_it_happened and was gone for $how_long.\n" .
"Number of aliens: $how_many\n" .
"Alien description: $alien_description\n" .
"What they did: $what_they_did\n" .
"Fang spotted: $fang_spotted\n" .
"Other comments: $other";
mail($to, $subject, $msg, 'From:' . $email);

echo 'Thanks for submitting the form.<br />';
echo 'You were abducted ' . $when_it_happened;
echo ' and were gone for ' . $how_long . '<br />';
echo 'Number of aliens: ' . $how_many . '<br />';
echo 'Describe them: ' . $alien_description . '<br />';
echo 'The aliens did this: ' . $what_they_did . '<br />';
echo 'Was Fang there? ' . $fang_spotted . '<br />';
echo 'Other comments: ' . $other . '<br />';
echo 'Your email address is ' . $email;
?>

Edited by Nathan2508, 15 May 2010 - 01:32 PM.



Nathan

#6 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:11:02 AM

Posted 15 May 2010 - 02:38 PM

Works fine for me when I generate a test app. Check and see that your email server is configured correctly in your php.ini

#7 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:12:02 PM

Posted 15 May 2010 - 11:05 PM

Place this in the next line after <?php
error_reporting(E_ALL);

This will show all errors you are having in php execution.

Edited by Romeo29, 15 May 2010 - 11:10 PM.


#8 Nathan2508

Nathan2508
  • Topic Starter

  • Members
  • 64 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Chicago, IL
  • Local time:11:02 AM

Posted 16 May 2010 - 11:50 AM

My e-mail seems to be configured correctly. It doesn't seem to be running the php script at all.

error_reporting(E_ALL); Does nothing.

When I first ran this with my editor it asked for the location of the executable file php-cgi.exe but it was nowhere to be found on my hard drive. I assumed it was just because I had a different build and pointed it to php.exe (the only .exe file I seem to have). So I just downloaded the newest PHP build and enabled CGI under "Turn Windows Features On or Off". Now php-cgi.exe is there so I pointed my editor to that.

Still no luck.


Nathan

#9 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:12:02 PM

Posted 16 May 2010 - 07:20 PM

Have you checked out this MS site about PHP on IIS : http://php.iis.net/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users