Jump to content

[SOLVED] Weird error... undefined function mysql_connect()


shlomikalfa

Recommended Posts

A. undefined function mysql_connect() ->> how could that be ?! and how should i fix it ?!

 

Is that on localhost or hosting?

 

 

B. how does it happen that when i open a .php file on local host i get it's content as output?!

 

What?

Link to comment
Share on other sites

check your php.ini to make sure the mysql and/or mysqli extensions aren't commented out

 

if that still doesn't work. make sure that your extension_dir directive in your ini file is correct, or copy the extensions to the directory it already expects them at.

 

After any changes to your ini file, remember to restart your apache server for the extensions to be loaded

Link to comment
Share on other sites

Well, i'm installing php server through WAMP5 latest version and it seems like everything was already set...

P.S > i've upgraded to latest wamp version yesterday and that's what created the issue. I have uninstalled the previous version through it's uninstaller before i've upgraded!

[but i haven't removed the mysql db if it has anything to do with it].

 

here are my efforts so far:

______________________

>> extension_dir = "c:/wamp/bin/php/php5.2.6/ext/"   ;;; Checked and folder exists with a lot of .dll files.

>> extension=php_mysql.dll ;;; C:\wamp\bin\php\php5.2.6\ext\php_mysql.dll exists.

>> extension=php_mysqli.dll ;;; C:\wamp\bin\php\php5.2.6\ext\php_mysqli.dll exists.

>> copied a file called libmysql.dll to the windows folder too ;;; DONE, c:\windows\libmysql.dll exists now.

>> Looked for "php_mysql.dll" inside c:\windows\system & c:\windows\system32 & c:\windows. it's not there!!!

 

EDIT>> COULD IT BE THAT ONLY THROUGH "ZEND" RUN function i get that error ? Cause when i open the web-page in the browser i don't get the error however i do get the source of the page as if "echo"ed out.

______________________

 

2nd ISSUE:

The Sticky doesn't say anything about my second issue... it seems like some of my pages are "echo"ing their source code on the page... why ? and how do i prevent it ?

 

 

Link to comment
Share on other sites

well... the modify button has disappeared....

 

Current Status:

A. i get the ""undefined function mysql_connect()"" from Zend Debugger only.

B. i get either blank page or the source code [or a part of it] from a normal browser [no errors!]

 

Please i need help please !!!

P.S. i am reading and have read the stickies....

Link to comment
Share on other sites

@Btown2

tried that.. didn't help !

 

@kenrbnsn

as i've written i do start it from the localhost path... yet same results !!!

_______

 

Also i have noticed that the pages which shows the source code holds these lines:

[which are marked by Zend as an error: "Assignment in condition"]

echo "StatEcho:";while($row = mysql_fetch_assoc($ServerDetails)){//Update information.echo $row["LatestVersion"];................

 

and i get in the Browser:

StatEcho:";
while($row = mysql_fetch_assoc($ServerDetails))
{
//Update information.
echo $row["LatestVersion"];
................

 

As you can see the first "Echo" is oky... the rest of it is an issue...

 

P.S >> i took these lines from the help file...

Link to comment
Share on other sites

@Btown2

tried that.. didn't help !

 

@kenrbnsn

as i've written i do start it from the localhost path... yet same results !!!

_______

 

Also i have noticed that the pages which shows the source code holds these lines:

[which are marked by Zend as an error: "Assignment in condition"]

StatEcho:";
while($row = mysql_fetch_assoc($ServerDetails))
{
//Update information.
echo $row["LatestVersion"];
................

 

and i get in the Browser:

echo "StatEcho:";while($row = mysql_fetch_assoc($ServerDetails)){//Update information.echo $row["LatestVersion"];................

As you can see the first "Echo" is oky... the rest of it is an issue...

 

P.S >> i took these lines from the help file...

Link to comment
Share on other sites

If you have WAMP installed you should not need to configure anything. WAMP sets everything up for you.

 

If you have had a previous installation of PHP before you installed WAMP then the problem could be to do with older php binaries/extensions being left behind after your removed your older PHP setup. All php binaries/extension must be of the same version as the version of PHP you have installed. If your newer PHP installation finds older binaries/extensions then you'll experience the kind of problems you're having now. This is why your should not move any files outside of the PHP Installation folder, if you do move any files then always make sure you keep track of which files you have moved and where to. Make sure you delete those files before installing a newer version of PHP.

 

To see if PHP is loading the mysql extension create a new file and call it info.php and place the folloiwng code in it:

<?php phpinfo(); ?>

Save info.php to WAMPs www folder (should be C:\wamp\www). Now go to http://localhost/info.php You should get a page displayed providing information about PHP's setup. Scroll down the page and see if you can find a mysql heading/section if you do PHP is setup correctly and so the issue is down to Zend.

 

If you can't find a Mysql heading/section and you have enabled the PHP extension via WAMPs control panel, then I'd recommend you to do the following. Go to Start > Search and search for the following files on at a time:

libmysql.dll

php_mysql.dll

php5ts.dll

 

Windows should only find once instance of each of the above files (they should only be located somewhere in C:\wamp), If you find more than one of instance of the above files either rename them or delete them

 

Now restart WAMP and run info.php. You should now find a MySQL heading/section.

Link to comment
Share on other sites

mysql
MySQL Support	enabled
Active Persistent Links 	0
Active Links 	0
Client API version 	5.0.51a

Directive	Local Value	Master Value
mysql.allow_persistent	On	On
mysql.connect_timeout	60	60
mysql.default_host	no value	no value
mysql.default_password	no value	no value
mysql.default_port	no value	no value
mysql.default_socket	no value	no value
mysql.default_user	no value	no value
mysql.max_links	Unlimited	Unlimited
mysql.max_persistent	Unlimited	Unlimited
mysql.trace_mode	Off	Off

it appears like i have it.... however i will now uninstall and delete the entire wamp folder and try re'installing it.... i will edit/post my results....

 

THANKS A LOT FOR TRYING TO HELP ME !!!

Link to comment
Share on other sites

Well oky, i've found the solution to my 2nd problem...

>> i had the php source code "ECHO"ed sometimes and blank pages on others...

 

well... it looks like i've downloaded the .httpaccess file along with my other .php sources from my host and that was what making all the trouble...

 

about zend, i will look into some zend help when i'll find the solution / if i'll find it... i will post it here.

 

[move]!!! THANKS FOR ALL THE HELP !!![/move]

Link to comment
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.