Forum Moderators: coopster

Message Too Old, No Replies

Connect MySql in Php

I access database in MySQL but not in PHP

         

percy05

6:36 pm on May 29, 2005 (gmt 0)

10+ Year Member



Hello, here is the problem: I can create databases and have access to it in MySQL environment, but when I want to connect it in Php I get the message:
Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in C:\Archivos de programa\Apache Group\Apache2\htdocs\x1.php on line 13
Error connecting to your mysql
I have read in some articles in MySQl manual but I understand it fails when you migrate from an old version of Mysql to a newer. I have MySql 4.3.10 and Apache 2, installed for the first time, and I can see simple php text files. I have read that I must use "old passwords" and something like it, but I guess it is nit my case. Does anyone have a solution for it? I have looked for a lot but don't have solution. THanks.

percy05

6:40 pm on May 29, 2005 (gmt 0)

10+ Year Member



Another pls: how do I verify of my PHP is installed as an Apache's module? Because I had also thought it could be a reason...- Thanks

lZakl

8:44 pm on May 29, 2005 (gmt 0)

10+ Year Member



percy,

I had the same (albeit different) problem. Not getting PHP to connect to MySQL, yet being able to connect via command line. Here is the thread. I know you said you didn't think it was the 'old password' problem, but have you tried to rectify it just incase? It worked for me..

[webmasterworld.com...]

-- Zak

percy05

9:09 pm on May 29, 2005 (gmt 0)

10+ Year Member



Hi Izakl, thanks too much, I will review it right now. A question please: how do you verify if your PHP has been installed as an Apache's module?

lZakl

10:33 pm on May 29, 2005 (gmt 0)

10+ Year Member



The easiest wat to test to see if PHP is working, is to create a script... I usually call this script 'test.php' originally enough. Inside this script, place this small piece of code:

<?php
phpinfo( );
?>

If you get a page back with all you php information on it, then PHP is installed. If all you see is your code in the upper left corder, then PHP is not installed correctly.

-- Zak

percy05

7:28 pm on May 30, 2005 (gmt 0)

10+ Year Member



Hello Zak. Thanks, it works well now ith that statement! But I still continue asking myself why it happened if I had not upgraded from a prior version of MySQL 4.1, I installed it directely from its site. Anyway, the most important, the problem was solved. You have helped me so much.
Thanks a lot,
Percy