PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old January 25th, 2003, 04:12 PM
nuts nuts is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 nuts User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Fatal error: Call to undefined function: mysql_connect()

On this machine PHP is unable to connect to MySQL.

Debian linux kernel 2.2.19
PHP version 4.0.3pl1,
MySQL distribution 3.22.32 on port 3306.

The PHP string

$link = mysql_connect( "localhost", "user", "password" )

produces this error message

Fatal error: Call to undefined function: mysql_connect()

The user & password are correct.

Replacing "localhost" with the IP number produces the same error.

Perl connects perfectly to mysql with the DBI module:

DBI->connect

PHP works perfectly with other functions.

phpinfo shows this configure command:

../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs'
'--with-regex=system' '--with-config-file-path=/etc/php4/apache'
'--enable-calendar' '--with-db' '--without-dom' '--enable-filepro'
'--enable-ftp' '--with-gettext' '--enable-sysvsem' '--enable-sysvshm'
'--enable-track-vars' '--enable-trans-sid' '--disable-debug'
'--disable-static' '--with-gd=shared' '--with-imap=shared'
'--with-ldap=shared,/usr' '--with-mm' '--with-mhash=shared'
'--with-mysql=shared,/usr' '--with-regex=system' '--with-pcre-regex=/usr'
'--with-pgsql=shared,/usr' '--with-snmp=shared' '--enable-sockets'
'--with-ttf' '--enable-freetype-4bit-antialias-hack' '--with-t1lib'
'--with-xml=shared,/usr' '--with-yp' '--with-zlib'


these loaded modules:

mod_php4, mod_setenvif, mod_unique_id, mod_expires, mod_auth, mod_access,
mod_rewrite, mod_alias, mod_userdir, mod_cgi, mod_dir, mod_autoindex,
mod_include, mod_status, mod_negotiation, mod_mime, mod_log_config,
mod_macro, mod_perl, mod_so, http_core


Debian sometimes has some strange paths.

The /etc/my.cnf file shows

socket = /var/run/mysqld/mysqld.sock

This symbolic link has to be made after reboot, before mysql will work:

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock


I plugged this socket value into /etc/php4/apache/php.ini:

===================
; Default port number for mysql_connect(). If unset, mysql_connect() will
use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only
look
' at MYSQL_PORT.
mysql.default_port =

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /var/run/mysqld/mysqld.sock

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo
cfg_get_var("mysql.default_password")
; and reveal this password! And of course, any users with read access to
this
; file will be able to reveal the password as well.
mysql.default_password =
===================

Rebooted (again), still get the Fatal error.


On another forum, this suggestion was made:

"One thing to try:
Look in php.ini for a line that reads something like ";extension=mysql.so"
and uncomment it. "

I did it, still no joy.

I suspect that the mysql.so lib is not available to PHP, but I am not up to
speed on PHP installation. My friend who did the install is unavailable.

Is this like a Perl lib:

/usr/local/lib/site_perl/i386-linux/auto/DBD/mysql/mysql.so

Can the mysql.so be installed in a lib directory somewhere, or does
apache/PHP need to be recompiled with the module present?

Does anybody have any ideas?

Thanks


Reply With Quote
  #2  
Old January 26th, 2003, 12:01 PM
postalcow postalcow is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Ford CIty, PA USA
Posts: 1,267 postalcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to postalcow
RE: Fatal error: Call to undefined function: mysql_connect()

add this to the line and see if it shows any different errors.

$link = mysql_connect( "localhost", "user", "password" ) or die(mysql_error());

Reply With Quote
  #3  
Old May 26th, 2003, 12:02 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Fatal error: Call to undefined function: mysql_connect()

Hi

Had the same problem and found the solution here.

http://www.vttoth.com/badmysql.htm

If you are using Debian ... then find the propriety directory somewhere in /usr/lib/

goodluck
mike

Reply With Quote
  #4  
Old June 3rd, 2003, 01:13 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Fatal error: Call to undefined function: mysql_connect()

i got the same message, and the fix at http://www.vttoth.com/badmysql.htm worked, but the file i had to edit was /etc/php.d/mysql.ini and put extension=mysql.so in there.

good luck!

Reply With Quote
  #5  
Old June 13th, 2003, 06:15 PM
commie29 commie29 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Quezon City, Philippines
Posts: 2 commie29 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to commie29
RE: Fatal error: Call to undefined function: mysql_connect()

I have the same error, but i can't seem to find my mysql.ini and mysql.so files! BTW, I have RH 8 installed and PHP and MySQL where installed as RPM's... Thanks in advance guyz!

Reply With Quote
  #6  
Old June 13th, 2003, 06:41 PM
postalcow postalcow is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Ford CIty, PA USA
Posts: 1,267 postalcow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to postalcow
RE: Fatal error: Call to undefined function: mysql_connect()

Your mysql.so file should be in /usr/lib/php4/mysql.so and there is no such thing as a mysql.ini file in linux that I know of. I thing you mean confuring it in the php.ini, don't you?

Reply With Quote
  #7  
Old June 14th, 2003, 04:22 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Fatal error: Call to undefined function: mysql_connect()

Hi,

I tried looking for mysql.so in the /usr/lib/php4 dir and it wasn't there... I tried searching for the mysql.so file and i found it at /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/DBD/mysql dir.
I edited php.ini and specified the extension_dir to that dir, and also making sure the extension=mysql.so was uncommented. I restarted apache and still, same result... Should i move the mysql.so file to the /usr/lib/php4 dir? Thanks for the reply...


Reply With Quote
  #8  
Old June 14th, 2003, 04:31 AM
commie29 commie29 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Quezon City, Philippines
Posts: 2 commie29 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to commie29
RE: Fatal error: Call to undefined function: mysql_connect()

Hi,

I tried looking for mysql.so in the /usr/lib/php4 dir and it wasn't there... I tried searching for the mysql.so file and i found it at /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/DBD/mysql dir.
I edited php.ini and specified the extension_dir to that dir, and also making sure the extension=mysql.so was uncommented. I restarted apache and still, same result... Should i move the mysql.so file to the /usr/lib/php4 dir? Thanks for the reply...

Reply With Quote
  #9  
Old July 26th, 2003, 01:41 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Fatal error: Call to undefined function: mysql_connect()

I was battling with this problem as well, this thread sent me on the right track, so thanks.

If anyone is still having the same problem and find the mysql.so in a perl-directory, here's the solution:
You'll need to get php4-mysql package (apt-get install php4-mysql). After that, locate mytsql.so (for me, it was now also found in /usr/lib/php4/20010901/mysql.so).
After that, change the extension_dir in php.ini to the new one. With this version of mysql.so set in php.ini, my MySQL connection started working perfectly.

Reply With Quote
  #10  
Old June 20th, 2004, 03:21 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Fatal error: Call to undefined function: mysql_connect()

thx i had the same problem but now in works fine.

thank you all.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > Fatal error: Call to undefined function: mysql_connect()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek