1

My PHP page is blank when I upload it to my server and navigate to it in a browser.

<form action="welcome.php" method="get">
    <input type="text" name="name" placeholder="enter first and last name" >
    <br />
    <input type="image" value="Submit" id="submit"/>
</form>

On the welcome.php page:

$fullName = $_GET['name'];
$firstName = explode(' ',trim($fullName));

<h2>Welcome <?php echo $firstName[0] ?>!</h2>

SOLVED. Permissions issue. The PHP file needed to be 644, not 666.

5
  • 1. What is <!-- SHTML Wrapper - 500 Server Error --> in source code ? 2. Looks like <input type="image" value="Submit" id="submit"/> is not submitting the form. Try to use <input type="submit"> instead.
    – BlitZ
    Sep 25, 2013 at 15:42
  • Found this: bluehostforum.com/…
    – evan
    Sep 25, 2013 at 15:44
  • It's a file and directory permission issue. See this post. Sep 25, 2013 at 15:48
  • Aha! Changed the permission to 644 and it worked. Thanks!!
    – evan
    Sep 25, 2013 at 15:50
  • hmm.. Amal Murali just posted in the comments and got all the credit. Maybe I'll try that next time. Sep 25, 2013 at 15:54

5 Answers 5

2

The problem:

<!– SHTML Wrapper – 500 Server Error –>

This is a silly Bluehost error. Typically related to file permissions. See here: http://www.bluehostforum.com/showthread.php?11101-SHTML-Wrapper-500-Server-Error-moving-to-a-new-box-helps

Just make sure that your file does not have the "world write" permission.

1

Try checking your server's Apache log file. This should give you some indication to the server error if any.

If you do not have access to the error log, add the following to the top of your PHP file. It will show any errors on the page you are viewing.

error_reporting(E_ALL);
ini_set('display_errors', 1);
1

One of the easiest solutions is enabling FastCGI from the cPanel PHPConfig.

Just enable it and everything will work.

1
  • What is "PHPConfig"? Can you provide a screenshot? Mar 26, 2020 at 20:16
0

Viewing the source code, you have an internal server error (500). Googling the error, you have WordPress(?) or this affects it.

<!– SHTML Wrapper – 500 Server Error –>

According to this guide, it's a problem with PHP CGI and you need to fix it in your host' panel, or manually via the terminal.

1
  • No it's just two pages, a really simple form. It seems like a lot of people are having this issue with Bluehost. Looks like I need to speak with them about FastCGI. Thanks!
    – evan
    Sep 25, 2013 at 15:49
0

This question is almost 10 years old, but I never saw this.

If you are using HostGator, do the following: go to cPanel –> MySQL Databases –> Add New User (set the password, and allow all or none of the query permissions – if you are a student then allow all permissions).

Now scroll down to "Add User To Database." Make sure the username you just created is linked to the database you are trying to use.

Here's a sample of how your code should look like:

// Server conditional values and connection
// This first if-statement connects to your localhost
if ($_SERVER['HTTP_HOST'] == 'localhost') {
        define('HOST', 'localhost');
        define('USER', 'root');
        define('PASS', '1550');
        define('DB', 'webPoll');
} else {
// Means that you are in a web server
        define('HOST', 'localhost');
        // localhost is the default parameter
        define('USER', 'kevin69_tacoUser'); 
        // add the username you just created
        define('PASS', 'hUIDnd193');
        // password for such username
        define('DB', 'kevin69_webPoll');
        // username_database
}
$conn = mysqli_connect(HOST, USER, PASS, DB);

Hope this helps someone out there!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.