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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call to undefined function: mysql_connect()

Status
Not open for further replies.

tryangle

Technical User
Mar 19, 2001
49
0
0
US
I checked phpinfo() and it lists this info beside Configure Command

'./configure' '--with-mysql=shared,/usr' '--with-xml' '--enable-track-vars' '--with-apxs=/usr/local/apache/bin/apxs'

It appears to have been configured with MySql support.

tia for any input on this,
tryangle

:)
 
Hi sleipnir214,

Yes, there is a section for MySql in the output of phpinfo()... but, I don't know if there were any errors pertaining to MySql when PHP was compiled. I don't think there were.

Is there anything I can check, after the fact?

Thanks for your response.
tryangle

:)
 
I'm also interested in the parameter you passed the configure script:

'--with-mysql=shared,/usr'


I don't use all those single quotes around the parameters, and use:

--with-mysql=/usr

as my MySQL parameter. I've never had a problem with MySQL and PHP.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Hi sleipnir214,

I just copied the info that was listed beside Configure Command on the phpinfo page. I think the quotes are just there as delimiters.

Is this something I can change in the php.ini file and restart Apache, or would I need to reinstall php?

Thanks again,
tryangle

:)
 
I see what you mean about the quotes in the phpinfo() output.

I'm very curious as to how the string "shared" got in your MySQL parameter.

But you have to recompile and reinstall PHP to make the kind of changes we're talking about.

What information, by the way, does phpinfo() give you about MySQL?

Want the best answers? Ask the best questions: TANSTAAFL!!
 
You compiled MySQL support as an extension that has to be enabled in
Code:
php.ini
for it to work. Do you have an extension line with the name of the MySQL module uncommented in your
Code:
php.ini
?

//Daniel
 
Hi sleipnir214,

I think I messed up in saying there is info about MySql in the phpinfo output. There isn't a block of info, like there is for php core, Apache, Apache environment, http headers... the only mention of mysql is near the top beside Configure Command, which I mentioned earlier.

Sounds to me like you nailed it.

A friend of mine helped me get this together a few months ago. I'm kinda flying by the seat of my pants. I'll see about tracking down info on recompiling and reinstalling PHP.

Thanks again,
tryangle

:)
 
Hi Daniel,

Thanks for picking up on this thread. I'm not sure what you mean. I can check the pho.ini file... what should I look for?

Thanks again,
tryangle

:)
 
Can you find a line like
Code:
extension=mysql.so
in your
Code:
php.ini
?

//Daniel
 
Hi Daniel,

I found it, it's commented out.

I'll uncomment it and restart httpd.

Thanks again,
tryangle

:)
 
Hi again,

I'm still getting the "Call to undefined function" error message though.

tryangle

:)
 
What's your setting for extension_dir in php.ini? PHP will look there for extension modules, including the one for MySQL.

If you're on a unix-like os and are using a filesystem that supports symbolic links, you might try forming a link from the directory pointed-to by extension_dir to your mysql.so file.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Hi sleipnir214,

In my php.ini file I have

extension_dir = "./"

just like that, with quotes, not commented out.

Thanks for getting back to me on this again.
tryangle

:)
 
Hi sleipnir214,

Do you mean like the same path as I have for datadir= in my.cnf?

Thanks again,
tryangle

:)
 
No. Do not point PHP to the directory where MySQL stores its data.

With the way you have installed PHP, it needs to use the MySQL client communications libaries as external libraries.

In order for it to do this, you must tell PHP to use the extension (by uncommenting the appropriate extension line) and tell PHP where it can find the library shared object files themselves.

I don't know whether PHP can use full pathnames with the extension directives. If it can (and you won't hurt anything by trying), set the "extension" entry for mysql.so to the absolute filename for the .so file.

If PHP won't take absolute pathnames, set extension_dir to some directory on your filesystem and make sure PHP can get to the .so files there. This is where symbolic links can come in handy.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Hi sleipnir214,

I'm not sure if I understood you correctly, but I changed the extension_dir and the mysql.so each to their respective full paths... and restarted httpd, but no joy.

Thanks again,
tryangle

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top