Home > Archive > PHP SQL > September 2004 > mySQL to connect in PHP in Windows?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
mySQL to connect in PHP in Windows?
|
|
|
| I'm using WinXP Pro, with apache 1.3? and PHP5.
Then today I installed mySQL 2.0.49.
Technically it works. I can use the command line to create tables and
insert data, I can use WinmySQLAdmin to view processes, etc.
But when I make a test script in PHP, nothing happens.
For example:
$dbh = mysql_connect("localhost", "username", "password") or die("I
cannot connect to the database because: " . mysql_error());
Nothing happens. I don't even get the error message. So changing
"localhost" to the PC name and the IP address of course didn't work,
because PHP isn't seeming to be talking to mySQL.
I opened up my php.ini and uncommented the one and only line with
mysql.dll in it.
Is there something in Apache's httpd.conf, that might need to be
changed? I couldn't find any commented out mysql lines.
Thanks for any help!
Liam
| |
|
| In article <3a1d1813.0409070655.9f2cbdc@posting.google.com>,
deja@celticbear.com says...
> I'm using WinXP Pro, with apache 1.3? and PHP5.
> Then today I installed mySQL 2.0.49.
> Technically it works. I can use the command line to create tables and
> insert data, I can use WinmySQLAdmin to view processes, etc.
> But when I make a test script in PHP, nothing happens.
>
> For example:
>
> $dbh = mysql_connect("localhost", "username", "password") or die("I
> cannot connect to the database because: " . mysql_error());
>
> Nothing happens. I don't even get the error message. So changing
> "localhost" to the PC name and the IP address of course didn't work,
> because PHP isn't seeming to be talking to mySQL.
>
> I opened up my php.ini and uncommented the one and only line with
> mysql.dll in it.
>
> Is there something in Apache's httpd.conf, that might need to be
> changed? I couldn't find any commented out mysql lines.
>
> Thanks for any help!
> Liam
>
Is the apache server up and running ?
What happens if you type in : http://localhost in your browser ?
> I opened up my php.ini and uncommented the one and only line with
> mysql.dll in it.
Put comment back in for now.
Rocky
Cross post removed
| |
| Bill Karwin 2004-09-07, 4:08 pm |
| LRW wrote:
> Is there something in Apache's httpd.conf, that might need to be
> changed? I couldn't find any commented out mysql lines.
Someone recently gave a reference to this excellent step-by-step
tutorial on configuring Apache, MySQL, and PHP on a Windows machine.
You have probably successfully done most of the steps described in the
tutorial, but it wouldn't take but a few minutes to read through it and
see if there's anything you missed. There are in fact a few httpd.conf
edits that they take you through.
http://internetmaster.com/installtutorial/
Bill K.
| |
| Polaris 2004-09-10, 3:57 pm |
| Copy all dlls (espsecially libmysql.dll) to your windows map and he will
read the php_mysql.dll extension and connect...
Polaris
"LRW" <deja@celticbear.com> schreef in bericht
news:3a1d1813.0409070655.9f2cbdc@posting.google.com...
> I'm using WinXP Pro, with apache 1.3? and PHP5.
> Then today I installed mySQL 2.0.49.
> Technically it works. I can use the command line to create tables and
> insert data, I can use WinmySQLAdmin to view processes, etc.
> But when I make a test script in PHP, nothing happens.
>
> For example:
>
> $dbh = mysql_connect("localhost", "username", "password") or die("I
> cannot connect to the database because: " . mysql_error());
>
> Nothing happens. I don't even get the error message. So changing
> "localhost" to the PC name and the IP address of course didn't work,
> because PHP isn't seeming to be talking to mySQL.
>
> I opened up my php.ini and uncommented the one and only line with
> mysql.dll in it.
>
> Is there something in Apache's httpd.conf, that might need to be
> changed? I couldn't find any commented out mysql lines.
>
> Thanks for any help!
> Liam
| |
| Joshu Cohen 2004-09-23, 3:55 am |
| I installed MySQL 4, PHP5, and apache 2 on Windows XP Home with a free
bundled package called apache2triad (highly recommended -- very easy to
install and it comes with PHPmyAdmin, python, perl, and lots more). I had
the same problem as you for a while. I'm just starting with this stuff --
it took me a month, actually, to get from PHP day one to be able to get
anything from a MySQL database to a web browser. I don't know anyone who
programs and it is very slow learning on my own. I finally got it working
yesterday though. I turned off my firewall, set apache and MySQL to start
when Windows starts -- then I rebooted the computer. Sometimes that is the
only way I can get everything working together. I think I read that Apache
2 and PHP5 on Windows is a bit experimental...
Actually, this code by itself:
<?php
$dbh = mysql_connect("localhost", "username", "password") or die
("I cannot connect to the database because: " . mysql_error());
?>
if it is working, will not send anything at all to the browser. Try just
that line -- then if it works (a blank screen), try adding each line one at
a time until you are at the point when you sent the data to the browser with
an 'echo'. The browser will be blank until you tell it to display
something with 'echo'. When your browser comes up blank, always "view
source" -- that can tell you if the PHP is being processed, or if it is just
being sent as text. The browser doesn't know what to do with <?php ... ?>
and the screen may show up blank. If you see any PHP in the browser's 'view
source' than you can identify the cause of the problem more easily. Also,
another common problem that I was having is that if there is one tiny
mistake in your PHP code it will not display anything at all in the browser.
I had to keep adjusting to code until I figured out where my mistake was. I
would recommend only adding one line at a time -- a blank browser is what
you are looking for until you output the data. Testing only that one line
of code will reduce the possibility that a code mistake is causing the blank
screens.
I am just a beginner, but those were some of the problems that were causing
me to get blank browsers.
Josh
----------------------------------------------------------------------------
-------------------
"LRW" <deja@celticbear.com> wrote in message
news:3a1d1813.0409070655.9f2cbdc@posting.google.com...
> I'm using WinXP Pro, with apache 1.3? and PHP5.
> Then today I installed mySQL 2.0.49.
> Technically it works. I can use the command line to create tables and
> insert data, I can use WinmySQLAdmin to view processes, etc.
> But when I make a test script in PHP, nothing happens.
>
> For example:
>
> $dbh = mysql_connect("localhost", "username", "password") or die("I
> cannot connect to the database because: " . mysql_error());
>
> Nothing happens. I don't even get the error message. So changing
> "localhost" to the PC name and the IP address of course didn't work,
> because PHP isn't seeming to be talking to mySQL.
>
> I opened up my php.ini and uncommented the one and only line with
> mysql.dll in it.
>
> Is there something in Apache's httpd.conf, that might need to be
> changed? I couldn't find any commented out mysql lines.
>
> Thanks for any help!
> Liam
|
|
|
|
|