Compile errors are not getting displayed.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
an_dileep
Forum Newbie
Posts: 2
Joined: Mon Aug 06, 2007 1:27 am

Compile errors are not getting displayed.

Post 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]
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post 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){
}
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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();
}
an_dileep
Forum Newbie
Posts: 2
Joined: Mon Aug 06, 2007 1:27 am

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

take a look at http://de2.php.net/mysql
esp. the paragraph "Installation on Windows Systems"
Post Reply