Jump to content

Recommended Posts

I am running php 5 and apache server on my computer. I am currently learning php at uni and we are using Mysql. I have just installed mysql on my machine and have run the server successfully and used mysql browser to open a script and populate some tables for some exercises I have done at Uni. I then procceded to change the php database connection information and run the files from home and I am recieving an error.

Fatal error: Call to undefined function mysql_connect() in D:\Apache Group\Apache2\htdocs\NightClassBrett\week 10\nw.php on line 27

The line it is reffering to is
$db=mysql_connect("localhost","root" ,"root");

The localhost psw and username are definatly correct. I set the psw to root.
Any ideas to what I may have done wrong in installation that could be causing this problem

I have also removed the ' in front of the line 'extension=php_mysql.dll
which I believe was nessacery. Is there any other alteration to the php.ini file I need to make ?

any help would be aprreciated.
Link to comment
https://forums.phpfreaks.com/topic/8766-phpmysql/
Share on other sites

Did you set up the extension_dir directive? Look for the following line in the php.ini:
[code]extension_dir = "./"[/code] change [b]./[/b] to the full path to where the php extension folder is located to, ie C:\php\ext

Now you need to save the php.ini and look a for a file called libmysql.dll and copy that to the Windows folder or add the php folder to the Windows PATH variable instead, saves moving any files.

Now restart your Apache web server and you should be able to use the mysql functions.
Link to comment
https://forums.phpfreaks.com/topic/8766-phpmysql/#findComment-32190
Share on other sites

Ok I got it working did a goodle search. I had just grabbed everything mysql*.dll and dumped it in the root. Info on the net was a bit scetcy as to which file goes where. I dont know if you can answer my next question because it is more mysql related but here goes. When I start the mysql server I ran the MySQLInstanceConfig.exe file. In the task manager I notice mysqld-nt.exe is running. At uni we run the mysql.exe to get the server going. The file is in the bin folder but when I go to run it the dos window comes up and closes. Even when I double click on the mysqld-nt.exe myself after Ive shut it down the program through task manager I cannot start the server my self without going back to the MySQLInstanceConfig.exe which is about a ten step process. So I guess my question is, is there any difference with the mysqld-nt.exe which is launching now when I reboot my computer. Vrs the mysql.exe. And if I dont want to it to auto launch and just use it when nessecary what file in the bin folder do I load to get the server going. I have tried a few and I have been checking to see if server is running through task manager and launching mysql browser which fails to connect.

Link to comment
https://forums.phpfreaks.com/topic/8766-phpmysql/#findComment-32194
Share on other sites

You shouldn't run the .exe files in the bin folder directly. They are not designed be executed through windows explorer. The way you execute the files in the bin folder is the in the command line.

Click Start > Run > type in cmd and click OK. The Command Line window should appear. Now type in the following:
[code]cd C:\MySQL\bin[/code]
and click enter now type in the following:
[code]mysql-nt --install[/code]
This will start the MySQL service. Then to stop mysql use the following, in the correct order:
[code]net stop MySql

mysql-nt --remove [/code]
Before you run the above command make sure you are in the MySQL bin folder.
Link to comment
https://forums.phpfreaks.com/topic/8766-phpmysql/#findComment-32220
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.