1

I have ubuntu server 14.04 installed along side Apache, PHP5 and MySQL server all together. I can gain access to the server using putty and the mysql database using Heidi Sql remotely.

On my laptop, using xampp to write and read from the database on the server works perfectly fine using PHP, but when the same code on the server is ran nothing happens the code stops at $connect = mysql_connect($host,$user,$pass) or die('Connection error');

After the code is run off the server the page remains blank and does not even show the Connection Error message in the die section.

Note: Apache, PHP and MySQL works fines because all my web pages are in PHP.

Parto
  • 15,647

1 Answers1

1

To display errors in your PHP environment, enter this line at the top of your config file - preferably before any code is run.

ini_set('display_errors',1);

To hide the errors, like when you go live, change the 1 to 0.


In case of this error Fatal error: Call to undefined function mysql_connect() in /var/www/html/Typit/Login.php just install the php5-mysql module using this command:

sudo apt-get install php5-mysql

Note:

The mysql_connect() extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQL extension should be used.

Source: http://www.php.net//manual/en/function.mysql-connect.php

Parto
  • 15,647