I am using Ubuntu 12.10 and i have installed LAMP. While i was learning PHP i came across a topic of connecting mysql and php. This is the code i learn
<?php
$db = mysql_connect('localhost','root','dbpass') or die('Unable to connect. Check your connection ');
$query = 'CREATE DATABASE IF NOT EXISTS moviesite';
mysql_query($query,$db) or die(mysql_error($db));
mysql_select_db('moviesite',$db) or die(mysql_error($db));
$query2 = 'CREATE TABLE movie (movie_id integer not null, moviename varchar(255) not null, movierating integer not null)';
mysql_query($query,$db) or die(mysql_error($db));
echo "movie database succecfully created ";
?>
When i try this in my windows environment (i have dual boot windows and ubuntu) , it works fine. In windows i am using eastPHP. But in ubuntu it doesn't shows anything. I have tried to find syntax errors but its just the same given in a book. So what can be the problem ?
If you get a blank page in the browser, you probably have a fatal error or a server configuration issue. Assuming you use Apache, look in the Apache error logs for some clues. On Ubuntu, it would be in /var/log/apache2/error.log
per default.