PHP scripts not working in public_html directory

jault

New member
Joined
Jan 30, 2007
Messages
2
Starting with an HTML page (ignore the file uploading test code)
there is a PHP section that does not produce the info or the print string, then on the file named "testfile.php" has the same result.
both files are in the same directory public_html/oaktree/
html file is 755 and the php file is 777
----------------- file one -----------
<html>
<head>
<title>Test File Form</title>
</head>
<body>
This form allows you to upload a file to the server.<br>

<form action="testfile.php" enctype="multipart/form-data" method="post"><br>
Type (or select) Filename: <input type="file" name="uploadFile">
<input type="submit" value="Upload File">
</form>
<p>php section to follow<p><br>
<?php
phpinfo();
$myage = 35;
print $myage;

?>
</body>
</html>
-------------- file two "testfile.php"
<html>
<head>
<title>Test File</title>
</head>
<body>
<p>test page for myName var = 35 using php<p>
<?php
phpinfo();
$myage = 35;
print $myage;

?>
</body>
</html>
--------------------------
I am a novice at PHP, obviously, and simply want to be able to make a very temporary spot on my server to let clients upload files, then I take it down.

Jim Ault
 
Last edited:
All I can find in any of the help documentation is that PHP is always available for any dir the public_html directory. I will contact my hosting admin to see if this is false. Thanks, and I will post back when I find the answer.

jim
 
You are trying to run php code in a .html file. You need to add to or create a .htaccess file with the following:

AddType application/x-httpd-php .php .html
 
Last edited:
Back
Top