Page 1 of 1

Compile errors are not getting displayed.

Posted: Mon Aug 06, 2007 4:43 am
by an_dileep
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi All,

Installed
PHP Version 5.2.3
Apache 2.0
Mysql 5.0
O/S Windows 2000 Professional
IE 6

Only outputs Hello, When I've executed the following code.

Code: Select all

<?php
echo 'Hello';
$data_base = 'testdb';
$conn = @mysql_connect('localhost','root','') or die ('Error');
mysql_select_db("$data_base");
if (!$conn) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
php?>

Not even displays the connection error or success message.

Do I need to configure any thing in the php.ini file ?
php.ini file is located at C:/Program files/php/

Do I need to relocate the ini file to some where else?


Thanks!


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Aug 06, 2007 4:50 am
by iknownothing
remove the @ symbol

Code: Select all

mysql_connect
and..

Why do you have 2 error calls for the one request??

Code: Select all

or die('Error');

and

if (!conn){
}

Posted: Mon Aug 06, 2007 4:55 am
by volka
If this is your development/test server:

run

Code: Select all

<?php echo 'ini: ', get_cfg_var('cfg_file_path'); ?>
It shows you which php.ini is used. Open this file in a text editor and change the following parameters (all of them are already in the file, you just have to change the value of each parameter. A semicolon at the beginning of a line marks a comment, ignore those lines.)

Code: Select all

error_reporting = E_ALL
display_errors = On
display_startup_errors = On
mysql.trace_mode = On
Save the file and restart apache.
Then check the changes via

Code: Select all

<?php
echo 'ini: ', get_cfg_var('cfg_file_path'), "<br />\n";

intval(ini_get('error_reporting'))===E_ALL or print("error_reporting != E_ALL<br />\n");
ini_get('display_errors') or print("display_errors = off<br />\n");
ini_get('display_startup_errors') or print("display_startup_errors = off<br />\n");

if ( !extension_loaded('mysql') ) {
	echo 'mysql extension not available';
}
else {
	echo 'mysql client info: ', mysql_get_client_info();
}

Posted: Mon Aug 06, 2007 8:08 am
by an_dileep
Hi Volka,

Thanks for reply!

I got the following output when I've updated in the ini file and executed the script which you advised.

Code:
ini: C:\Program Files\PHP\php.ini
mysql extension not available

Any help ?

Thanks in advance.

Posted: Mon Aug 06, 2007 8:53 am
by volka
take a look at http://de2.php.net/mysql
esp. the paragraph "Installation on Windows Systems"