Search the Community
Showing results for tags '500'.
-
Hey guys, So I making a basic website form to do CRUD operations on a database, and all of my components work, but I keep getting 500 - Internal server error on my index.php Heres my code: <?php require_once('config.php'); require_once('menu.php'); echo '<h1>View All Alien Interactions</h1>'; /* Start the table with the fields we want to display Remember $fields is now in config.php */ echo '<table> <tr>'; foreach($fields AS $label){ // th is a table header; the column's title or label. echo "<th>{$label}</th>"; } //Add the edit and delete columns at the end of the table echo '<th>Edit</th><th>Delete</th>'; echo '</tr>'; /* Select the fields we want, from all the rows The first line takes the array keys from our $fields array and implodes them, using backticks and commas. The end result will look like `first_name`, `last_name`, `phone_number`... The next line creates a SELECT query using that string. */ $fields_str = '`contact_id`, `'.implode(array_keys($fields), '`, `').'`'; $sql = "SELECT {$fields_str} FROM `aliens_abduction`"; foreach($dbh->query($sql) as $row) { echo '<tr>'; // Loop through the fields again to display them for this row. // Note: The tutorial originally contained an error here, this has been updated. foreach($fields AS $field=>$value){ // if the field is blank, we want to empty a blank space, otherwise the HTML won't work properly echo '<td>'.(isset($row[$field]) && strlen($row[$field]) ? $row[$field] : ' '.'</td>'); } echo '</tr>'; echo '<td><a href="edit.php?contact_id='.$row['contact_id'].'">Edit</a></td>'; echo '<td><a href="delete.php?contact_id='.$row['contact_id'].'">Delete</a></td>'; echo '</tr>'; echo '</table>'; ?> and heres my config.php code (idk if this is the root of the problem, i dummied out my credentials): <?php //Connect to the database $dbh = new PDO('mysql:host=xxxxxxxxx;dbname=db_demo', 'xxxxx', 'xxxxx'); //Set the default fetch mode to be an associative array. $dbh->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); //Define the fields for our CRUD application $fields = array( 'first_name' => 'First Name', 'last_name' => 'Last Name', 'when_it_happened' => 'When it happened', 'how_many' => 'How many', 'alien_description' => 'Alien description', 'what_they_did' => 'What they did', 'fang_spotted' => 'Fang spotted', 'email' => 'Email' ); ?>
-
I am running the MindTouch Core 10.1.3 CMS web application on a 2008 R2 SP1 server and am running into issues. I have posted the issue over on those forums and ServerFault but I think it is more related to PHP itself and the environment. The problem doesn't happen locally with a similar VM on our network, just on the public one hosted online. Basically, every few hours or so, we will receive an HTTP error 500 message either in the browser or in the logs. This happens when browsing pages and is especially reproducible when uploading files (usually between 5-10MB). Simply refreshing the page or trying to upload the file again will allow it to eventually complete. In IIS, I see several entries of the following under FailedReqLogfiles: ModuleName ManagedPipelineHandler Notification 128 HttpStatus 500 HttpReason Internal Server Error HttpSubStatus 0 ErrorCode 0 ConfigExceptionInfo Notification EXECUTE_REQUEST_HANDLER ErrorCode The operation completed successfully. (0x0) The PHP version is 5.2.14 (version that ships with MindTouch). I will also see some entries in the PHP error log that show: [05-Mar-2013 15:03:31] PHP Warning: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in C:\Program Files (x86)\MindTouch\MindTouch\web\skins\error-settings.php on line 93 The server is a virtual machine with 4GB RAM and 4 vCPUs. It is hosted in the cloud and accessible over the web. What things can I look at to troubleshoot this issue? Are there settings on the properties of the App Pool that I should review? Any help is greatly appreciated.