0

I used Lynda.com to install Apache, so I feel comfortable that PHP was installed correctly and works on my computer. I've tested the code through localhost and it works when I do it there, but once I upload the PHP files via FTP and I go to the webpage in Chrome, it just shows up as PHP code.

I have 2 PHP files, and they work as a simple form. One leads to the other through $_POST methods.

So the real question is - why doesn't my PHP code execute once it is on the webserver?

MY UPLOADED PHP CODE PAGE 1: http://pages.iu.edu/~smithtro/JPTeam/joes.php

MY UPLOADED HTML CODE PAGE 1 (just for reference, this is what I want): http://pages.iu.edu/~smithtro/JPTeam/joes.html

the html page redirects to the form processing page.

  • You need to configure PHP to run in an HTML page. – Jay Blanchard Jul 17 '15 at 17:18
  • possible duplicate of [Using .htaccess to make all .html pages to run as .php files?](http://stackoverflow.com/questions/4687208/using-htaccess-to-make-all-html-pages-to-run-as-php-files) – Jay Blanchard Jul 17 '15 at 17:19
  • Post your php code please – Ethan Brouwer Jul 17 '15 at 17:20
  • 1
    Installing Apache alone does not give oneself the ability to run PHP code. You mean to make sure the module for PHP is installed on the system and registered in the configuration file for Apache. Also you need to make sure the PHP files are handled as executable code by the server. Given that I've looked at the joes.php file you linked, and there isn't any PHP code in the file. Is there some reason you need this particular file to be PHP and not plain HTML? – Bradley M Handy Jul 17 '15 at 17:21
  • You're HTML page calls form_processing.html. Maybe you want your php in that file with a .php extension. BUt you need to explain more for me to understand – BigScar Jul 17 '15 at 17:27
  • I'm using joes.php instead of joes.html just because I followed a tutorial from lynda.com and that's what they did in the video. But you're right, Bradley, only form_processing.php needs to be a PHP file, correct? Should I just make joes.php -> joes.html and update the links? And then does the real issue lie in form_processing.php? – Troy Smith Jul 17 '15 at 17:39
  • Your university's web server may not support PHP, or may require special configuration to use it. Contact your IT support center for details. –  Jul 17 '15 at 20:43

2 Answers2

0

Both the joes.php and form_processing.php files are showing raw content. I'm leaning toward a lack of configuration in the Apache httpd.conf file.

I would consult a page for PHP Configuration Instructions. On the linked page, look at steps 7 and 8. Don't forget to restart Apache after making any configuration changes.

Bradley M Handy
  • 603
  • 6
  • 15
0

I contacted IU's tech department (I should've just googled it, I would've got the same answer) and it turns out that the server I uploaded to was not PHP enabled.