0

Okay, so I had a website that was perfectly functional, I haven't done any changes at all, but I know after my host updated their CP to V2, this happened:

PHP Code like this:

<?php
  $result = mysql_query("SELECT * FROM tz_members ORDER BY id");
  echo "<table border='0'>
    <tr>
      <th style='width: 15px'>ID</th>
      <th style='width: 300px'>Username</th>
      <th style='width: 100px'>Privileges</th>
      <th style='width: 200px'>Join Date</th>
    </tr>";

  while($row = mysql_fetch_array($result))
  {
    echo "<tr>";
    echo "<td>" . $row['id'] . "</td>";
    echo "<td>" . $row['usr'] . "</td>";
    echo "<td>" . $row['priv'] . "</td>";
    echo "<td>" . $row['dt'] . "</td>";
    echo "</tr>";
  }
  echo "</table>";
?>
</center>
<?php
  endif;
?>

Now instead of properly outputting my member list, will show up as plain text. Here's the page that should display an example: http://www.cod5showtime.url.ph/members.html

Few PHP functions still work properly, any ideas why ? :/

Robbert
  • 6,481
  • 5
  • 35
  • 61
Cristian D
  • 673
  • 5
  • 21
  • 1
    Ask your administrator to fix what they broken then? – zerkms Feb 18 '14 at 21:10
  • What do you mean by some php functions still work? Which? Which does not? Did you use shorttags? Have you contacted the host.... – Ronni Skansing Feb 18 '14 at 21:11
  • 1
    What is this `` – Ronni Skansing Feb 18 '14 at 21:12
  • I have created a new file called test.html, and tried to `include` some of my files, even `echo` and it all worked, the problem suddenly appeared on problems that existed in the moment of the update, although I doubt the host had done anything, I belive it's soemthing related to .htaccess although I never touch that file. – Cristian D Feb 18 '14 at 21:12
  • 6
    If you change the name of the file to members.php, does it work? – Robbert Feb 18 '14 at 21:13
  • @RonniSkansing, it's a page that only runs the PHP code if a session exists, so member list is only viewable by logged users (having session created) – Cristian D Feb 18 '14 at 21:13
  • Does the PHP code in 'footer.php' or 'social.php' run? – Sergiu Paraschiv Feb 18 '14 at 21:14
  • @Robbert, yes, apparently it works, I assume it has something to do with extensions then ? All, apparently if I change file extension from .html to .php it works, why's that ? – Cristian D Feb 18 '14 at 21:14
  • By default .html pages are not parsed for php. So if your hosting provider made an update, it most likely killed your setting to parse .html pages as php. – SidewaysGravity Feb 18 '14 at 21:16
  • Probably the new configuration that was set up does not enable PHP execution in .html resources. This answer might help: http://forums.cpanel.net/f34/html-files-via-php-engine-63914.html – Sergiu Paraschiv Feb 18 '14 at 21:16
  • 2
    One final comment, you should consider using [PDO](http://us2.php.net/PDO) or [mysqli](http://us2.php.net/mysqli) instead of the deprecated mysql_ functions. – Robbert Feb 18 '14 at 21:24

4 Answers4

4

PHP is generally parsed when the file name ends in php. You can configure the server to use other extensions, such as html, but it appears your administrator didn't recreate the setting when he or she upgraded your server.

Robbert
  • 6,481
  • 5
  • 35
  • 61
  • Actually this has nothing to do with PHP as it does not care about _file_ extensions. The webserver (Apache HTTPD, IIS, nginx, etc) on the other hand does care about _resource_ extensions (URIs). This is a webserver-level config option, not php.ini setting. – Sergiu Paraschiv Feb 18 '14 at 21:20
  • PHP does not require files to end with .php – Ronni Skansing Feb 18 '14 at 21:20
3

Your host has made a change to the configuration. It no longer parses .html as php.

Rename to .php or take a look at Using .htaccess to make all .html pages to run as .php files?

Community
  • 1
  • 1
Ronni Skansing
  • 1,494
  • 1
  • 17
  • 33
1

rename your file to members.php

Karim Lahlou
  • 168
  • 5
0

Use .htaccess anyway,but be sure of what you do there. It is most recommended to have the power of parsing and rendering on your side, especialy when you know there an upgrade on your host's side. One more thing - backup, backup,backup.

Ofer
  • 11
  • 2