By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,680 Members | 1,666 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,680 IT Pros & Developers. It's quick & easy.

problem for showing output of php file

P: 18
i installed wamp5 in windows xp.it shows all services are working.but when am opened a php file using browser it show a white page only,not show the out put. what is the reason?
Jan 5 '10 #1

✓ answered by udaypawar

If you are working with IIS, PHP and mysql there might be a problem that mysql extension is not enabled by default.

Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\my.php on line 6

This error says that library for mysql is not found. You can search for libmysql and register that dll with windows plus search for php_mysql.dll and put it in extensions directory of PHP.

Then go to php.ini file and enable mysql.




Better option is to install latest version of wamp 5. Your first installation for WAMP was correct but showing blank page because there was error on the page.

Click on wamp server icon (In taskbar) -> PHP -> PHP settings-> select display_error. It should be true. Then open php.ini search for error_reporting and make it E_ALL. With this settings your PHP will display you all the errors instead of blank page.

Share this Question
Share on Google+
18 Replies


Dheeraj Joshi
Expert 100+
P: 1,123
What code you have written.? Can you post the code you have written.?

Regards
Dheeraj Joshi
Jan 5 '10 #2

P: 18
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $a=5;
  3. $b=10;
  4. $c=$a+$b;
  5. echo "vale is"$c;
  6. ?>
Jan 5 '10 #3

Dheeraj Joshi
Expert 100+
P: 1,123
Put that PHP in <body></body> tags of HTML

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <?php
  4. $a = 4;
  5. $b = 6;
  6. $c = $a+$b;
  7. echo $c;
  8. ?>
  9. </body>
  10. </html>
  11.  
Jan 5 '10 #4

gits
Expert Mod 5K+
P: 5,390
i think line 5 in post #3 throws an error which can be fixed with:
Expand|Select|Wrap|Line Numbers
  1. echo "vale is".$c;
since the operator for the string concat is missing.

kind regards
Jan 5 '10 #5

P: 18
am tried another way also...iis ,php,mysql and windows xp.
using this also when am connecting to mysql db don't showing any errors.the browser page only shows blank.wt is the reason

this is the code am runned in browser

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <?php
  4. //remember to change the password to whatever you set
  5. //it to in mysql instance configuration
  6.  
  7. //first parameter is server name, 2nd username 'root', 3rd is password
  8. $rst = @mysql_connect("localhost","root","root");
  9.  
  10. if (!$rst)
  11. {
  12.      echo "<p>Unable to connect to database manager.</p>" ;
  13.          die ('Could not connect: '. mysql_error());
  14.      exit();
  15. }
  16.  else 
  17. {
  18.   echo "<p>Successfully Connected to MySQL Database Manager!</p>" ;
  19. }
  20.  
  21. if (! @mysql_select_db("mysql") )
  22. {
  23.      echo "<p>Unable to  connect database...</p>";
  24.      exit();
  25. else 
  26. {
  27.   echo "<p>Successfully Connected to Database 'MYSQL'!</p>" ;
  28. }
  29. ?>
  30. </body>
  31. </html>
Jan 5 '10 #6

Markus
Expert 5K+
P: 6,050
If you right-click on the page and select 'View Source' (or something like that), what do you see? Do you see the PHP code?
Jan 5 '10 #7

P: 18
it shows only<html><body>only
Jan 5 '10 #8

Markus
Expert 5K+
P: 6,050
So the PHP is being parsed - a good start.

Place this at the very beginning of your page:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. echo "<h1>It works!</h1>";
  3. ?>
  4.  
Do you see anything?
Jan 5 '10 #9

P: 18
the above code is working(ur code).

but y my code is not working?
Jan 5 '10 #10

P: 18
i think their is some roblem in mysql connection..thats am not get my code...thank u 4 helping
Jan 5 '10 #11

P: 18
for mysql-php connection what i want to do? mysql and php is working seperately working..anybody help??
Jan 5 '10 #12

Markus
Expert 5K+
P: 6,050
Okay - let's see what MySQL is complaining about.

Try this code, remember to fill in your MySQL server credentials.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. print("Attempting to connect to MySQL<br />");
  4.  
  5. /** Change these to your correct details */
  6. $link = mysql_connect("localhost", "root", "root");
  7.  
  8. if (!$link) {
  9.     printf("Unable to establish connection to MySQL. Reason:<br /><br />%s",
  10.             mysql_error());
  11. }
  12. else {
  13.     print("Connection successful.<br />");
  14. }
  15.  
Jan 5 '10 #13

P: 18
not display output in browser(white page only )

can u give example for "localhost"
Jan 5 '10 #14

P: 18
sorry
it display another error

Attempting to connect to MySQL

Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\my.php on line 6
Jan 5 '10 #15

P: 18
ur code have an error.....before mysql_connect a @ symbol is needed.
i correct that error.then display as

Attempting to connect to MySQL
Jan 5 '10 #16

P: 29
If you are working with IIS, PHP and mysql there might be a problem that mysql extension is not enabled by default.

Fatal error: Call to undefined function mysql_connect() in C:\Inetpub\wwwroot\my.php on line 6

This error says that library for mysql is not found. You can search for libmysql and register that dll with windows plus search for php_mysql.dll and put it in extensions directory of PHP.

Then go to php.ini file and enable mysql.




Better option is to install latest version of wamp 5. Your first installation for WAMP was correct but showing blank page because there was error on the page.

Click on wamp server icon (In taskbar) -> PHP -> PHP settings-> select display_error. It should be true. Then open php.ini search for error_reporting and make it E_ALL. With this settings your PHP will display you all the errors instead of blank page.
Jan 5 '10 #17

Markus
Expert 5K+
P: 6,050
@curi444
No - that's not an error. I intentionally omitted it from my code. The @ symbol suppresses any errors that may arise from a function call. If you use it, you won't know of an error occurring (much like what has just happened). When we take away the @ symbol, the PHP engine tells us that you don't have a function called mysql_connect. That is, you haven't enabled mysql in your PHP configuration. Open up your php.ini file and remove the ';' from a line that looks like this:

Expand|Select|Wrap|Line Numbers
  1. ;extension=mysql.dll
  2.  
Jan 5 '10 #18

P: 18
i re installed wamp5 refering this link
http://www.rasyid.net/2007/07/09/ste...in-windows-xp/

find it is very helpful

thanks all of u for help me
Jan 5 '10 #19

Post your reply

Sign in to post your reply or Sign up for a free account.