Forum Moderators: coopster

Message Too Old, No Replies

New dev machine - php on web pages not working

         

larry29936

2:25 pm on Jul 23, 2020 (gmt 0)

5+ Year Member Top Contributors Of The Month



My old dev machine died. Set up a new dev machine and installed LAMP stack (Apache 2.4, Mysql 8, php7.4).All the web pages that have php code that worked on the old machine no longer work giving a http 500 error. Example code follows:
 <?php

$php_scripts = '../php/';
require $php_scripts . 'PDO_Connection_Select.php';
require $php_scripts . 'GetUserIpAddr.php';

{
$ip = GetUserIpAddr();
if (!$pdo = PDOConnect("foxclone_data")) {
exit;
}
{
$stmt = $pdo->prepare("INSERT INTO download (address) values (?)");
$stmt->execute([$ip]) ;
}
}

?>

<!DOCTYPE html> <!-- showing brown like php code in editor -->
<html lang="en">
<head>
etc,etc....`

I've double checked the installation steps for php and can't see what I've missed. phpMyadmin does work properly. Does anyone have any idea what's gone wrong?

w3dk

2:45 pm on Jul 23, 2020 (gmt 0)

10+ Year Member Top Contributors Of The Month



Check your server's error log for the details of the error.

What were the versions of PHP and MySQL on the old server?

If there is a fatal PHP error and display_errors is "off" then you'll get a 500 response.

larry29936

3:12 pm on Jul 23, 2020 (gmt 0)

5+ Year Member Top Contributors Of The Month



@w3dk found the problem. When I recreated the database, it failed to set where the autoincrement should start at on the id field in a table. It's giving me a duplicate key error. How do I tell it where to start the increment?

larry29936

3:22 pm on Jul 23, 2020 (gmt 0)

5+ Year Member Top Contributors Of The Month



Got it fixed. Thanks