[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

PHP programs running through Firefox

Posted on 2016-11-09
4
Medium Priority
?
47 Views
Last Modified: 2016-11-28
I've been doing some training working with PHP and MySQL, and have up to now, been running from a virtual machine operating with Debian Linux.
As I'm starting to work with MySQL, I don't want to be working on the VM so trying to run both from my own system as the server, but when I write the code and try and load through Firefox all I get is a blank screen. The code is as follows:

<html>
<head>
<title>Creating MySQL Database</title>
</head>
<body>
<?PHP
$dbhost = 'localhost:3036';
$dbuser = 'XXXX';
$dbpass = 'XXXXXXXX';

$conn = mysqli_connect($dbhost, $dbuser, $dbpass);
if(! $conn ) {
die('Could not connect: ' . mysqli_error($conn));
}
echo 'Connected successfully\n';
$sql = 'CREATE DATABASE TUTORIALS';
$retval = mysqli_query( $sql, $conn );
if(! $retval ) {
die('Could not create database: ' . mysqli_error($conn));
}
echo 'Database TUTORIALS created successfully\n';
mysqli_close($conn);
?>
</body>
</html>

Open in new window


I've downloaded PHP and MySQL through Wampserver64, and have been able to run PHPMYADMIN with no problems, and also able to turn on and off the MySQL through it's own Root Device, but cannot get it to run through Firefox.

Our own company system is built on PHP with Javascript which runs fine through Firefox.

Can anyone offer some help as to how I can resolve this issue?
0
Comment
Question by:Neil Brookes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 41880330
First step - remove all of the HTML - that only muddies the water here.

Try adding these lines to the PHP script, right at the top.  This will let you see if PHP is getting used at all, and if it encounters any errors.
ini_set('display_errors', TRUE);
error_reporting(E_ALL);
echo 'Hello World';

Open in new window

0
 

Author Comment

by:Neil Brookes
ID: 41880335
Thanks Ray

I have just tried that, but all that does when I open with Firefox is display the entire code as a text document.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points (awarded by participants)
ID: 41880346
Good!  That's actually progress.  It means that the script is not getting parsed through PHP.  If it's file is named ending in .php it should be possible to set up Apache so this happens automatically.  Please see this article (you may or may not want to parse HTML files, but you certainly want to parse PHP files)
https://encodable.com/parse_html_files_as_php/
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 41903926
E-E asked me close this question
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question