Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice needed: What PHP MySQL combination to use? 1

Status
Not open for further replies.

jabw

Technical User
Apr 30, 2003
103
NL
Hi,

I've been struggling with PHP(4.4.0) and MySQL 4.1 for a couple of weeks now and the main problem I have is connecting to MySQL 4.1 from PHP4. Te result is that all those nice and simple examples in my books don't work. Because I can not connect from PHP to MySQL.

Something related to login has changed here..

To get rid of all problems and focus at the future I could do with some advice.
What PHP and What MySQL version packages or what ever do I need to make a nice working PHP MySQL system running on Windows 2003 with IIS6.
(without i.e.: first recompiling a package from it's source code?)
 
First, when you download Windows binaries, there is no need to recompile, they come nice Windows Installers, that do most of the config work for you. Both from Mysql and PHP. I believe one all inclusive package is EasyPHP. check here.
Second why don't you tell us, what connection problems you are having and maybe we can sort them out without having to reinstall everything.

Basically a simple mysql connection from PHP would look like:

Code:
$connection = mysql_connect("dbserver", "user", "password") or die(mysql_error());
mysql_select_db("databasename",$connection);
$qry="Select *from sometable";
$results=mysql_query($qry,$connection);

That should connect to the DB provided the credentials are valid, and run a query and return results to the $results variable.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
With MySQL 4 you should use the mysqli set of functions. Older MySQL servers use mysql set of functions.
I think it is in your best interest to use the latest set of MySQL and PHP and find out how to adjust what the book says to make it work.
 
DRJ478 makes a good point I forgot to make. How old are the books, and what particular set functions do they refer to?



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
The books are not realy uptodate.
I've downloaded php-4.4.0 and MySQL 4.1.14-win32.
The install itself is not a problem but the combination give problems like:
Client does not support authentication protocol upgrade etc.

This has to do with a change in MySQL 4.0 to 4.1.

Looks like
$connection = mysql_connect("dbserver", "user", "password") or die(mysql_error());
doesn't working in this combination.

(btw. Tried to compile 4.4.0 from source code but that failed with errors php4dllts.pch': Permission denied. So there's no solution).

Therefore my question: What combination is adviced to use here.
 
When you say

Jabw said:
$connection = mysql_connect("dbserver", "user", "password") or die(mysql_error());
doesn't working in this combination.

what error does it come back with??

As I stated previously, combined packages such as Easyphp. tend to give the begginner user less problems when setting them up.

If the books are not uptodate, it might be that the functions being used have changed to expect different parameters in newer versions of PHP. or have been rendered obsolete all together. ie. Deprecated.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks.

At the moment I don't have the system available so I can't give the exact error message.

Perhaps it's a good idea to get along with Easyphp first.

Or go with a fresh compiled version from the Source code.
In the meantime I've succeeded in compiling it from the Source code. Including a php4isapi.dll.
I will check on for additional info.

Again, thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top