Images not displaying on new installation.
Posted by: Zaaka72 (---.11-2.cable.virginm.net)
Date: April 05, 2018 12:59AM

I have wampserver on my development laptop (Apache 2.4.23 - PHP 5.6.25 - MySQL 5.7.14) which has been working fine, now my laptop is old and dying I am moving my website/intranet to a proper pc with ssd.

I have downloaded the latest version of the 64bit WAMP, got it up and running fine, but no pictures are being displayed, I have one a complete backup of the laptops www folder and the MySQLi database, copied it to the new server, but images don't work, I have the following which still works on the laptop.

<?php
require('../../js/db.php');
$id = $_GET['id'];
$query = "SELECT image_type, image FROM mums_books WHERE id = ".$id;
$result = $Conn->query($query);
$row = $result->fetch_assoc();
$image = $row['image'];
header('Content-Type: '.$row['image_type']);
echo $image;
?>


This pulls a thumbnail from the database to display on the webpage, the mime type is added to the DB when the image is uploaded, so it creates the proper header each time the script is called.

Is this a problem with WAMP, because the same script still runs ok on my laptop?

Options: ReplyQuote
Re: Images not displaying on new installation.
Posted by: Otomatic (Moderator)
Date: April 05, 2018 09:24AM

Hi,

> Is this a problem with WAMP, because the same script still runs ok on my laptop?

That doesn't prove anything!
Are they the same Apache, PHP and MySQL versions?
Do these versions have exactly the same settings and extensions?

Besides, your script doesn't check anything, but then nothing of anything.

The 'id' index is not checked as existing.
The content received by $_GET['id'] is not checked.
It is not checked that the request has been executed correctly.
It is not verified that there is a result to this query and that it is valid.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Images not displaying on new installation.
Posted by: Zaaka72 (---.11-2.cable.virginm.net)
Date: April 05, 2018 09:31PM

Thanks for the reply, but this script only gets called when ID exists, and the connection check is in the DB.php which is included, as this works on the laptop version and did work on my PC version till reinstalling WAMP, I am looking for more constructive help! I have been told (from another WAMP user) that it could be the headers that new WAMP uses. How could I check this?

LAPTOP WAMP v 3.06 (Apache 2.4.23 - PHP 5.6.25 - MySQL 5.7.14)
PC WAMP v3.1.0 (Apache 2.4.27 - PHP 5.6.31 - MySQL 5.7.19)

Options: ReplyQuote
Re: Images not displaying on new installation.
Posted by: Otomatic (Moderator)
Date: April 05, 2018 10:45PM

Hi,

> I have been told (from another WAMP user) that it could be the headers that new WAMP uses
Wampserver itself does not send any header whatsoever.

As I wrote earlier, you have different configurations:
Not the same Apache versions
Not the same PHP versions
Not the same MySQL versions
So, necessarily, PHP extensions that do not have the same versions and PHP parameters that are also not the same.
Have you checked the Apache, PHP and MySQL log files for errors or warnings.
As long as you have different environments, no reliable comparison is possible.

Start already by comparing the results of phpinfo() between the two environments. You can also compare HTML sources in both cases.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Images not displaying on new installation.
Posted by: RiggsFolly (Moderator)
Date: April 06, 2018 12:41AM

How did you backup and restore your database

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Images not displaying on new installation.
Posted by: Zaaka72 (---.11-2.cable.virginm.net)
Date: April 06, 2018 05:29AM

Thanks all, but I have sorted it now

Options: ReplyQuote
Re: Images not displaying on new installation.
Posted by: RiggsFolly (Moderator)
Date: April 06, 2018 09:44AM

Glad to hear it.

Please can you explain what you did to "Sort it" as this may be useful to others who may find this thread who have similar problems.

Thanks

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.