Re: [PHP-DB] 64-bit Linux -- Fatal ... undefined function mysql_connect()

2010-03-01 Thread Chris

andrew jarcho wrote:

Hello all,

I'm running Fedora 12 (64-bit), Apache 2.2.14, PHP 5.3.1, MySQL
5.1.42, on a Dell laptop.





I get the message:

Fatal error: Call to undefined function mysql_connect()





The output of my phpinfo() includes:


Is that from command line or webpage? They may read different php.ini files.

# php -i | grep mysql

return anything from the command line?

which config is it reading?

# php -i | grep php.ini

Is it the one you were editing previously?

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] 64-bit Linux -- Fatal ... undefined function mysql_connect()

2010-03-01 Thread Chaitanya Yanamadala
hai andrew
Can u try like changing the ini file like this..
 under mysql
change the to
mysql.default_port  3306  3306

and also if this time too it is not getting connected to the socket
try using the mysqli construct to connect to database..


this is for your reference
http://php.net/manual/en/mysqli.connect.php





Chaitanya

"A man can get discouraged many times but he is not a failure until he stops
trying..."

"I would love to change the world, but I can't get the source code."



On Tue, Mar 2, 2010 at 10:24 AM, andrew jarcho wrote:

> Hello all,
>
> I'm running Fedora 12 (64-bit), Apache 2.2.14, PHP 5.3.1, MySQL
> 5.1.42, on a Dell laptop.
>
> I'm trying to access a local MySQL database using PHP. When I execute
> this code from the shell (as: php testcode.php)
>
>$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
>if (!$link) {
>   die('Could not connect: ' . mysql_error());
>}
>echo 'Connected successfully';
>mysql_close($link);
>?>
>
> I get the message:
>
> Fatal error: Call to undefined function mysql_connect()
>
> The FAQ on the PHP site says:
>
> "Unix users, at least the ones who know what they are doing, tend to
> always build PHP against their system's
> libmysqlclient library simply by adding the --with-mysql=/usr option
> when building PHP."
>
> But I'd like to avoid compiling PHP from source. I've had endless
> trouble getting non-rpm code to play nice with
> this 64-bit distro of Fedora. Also, I don't want to wind up with
> multiple copies of PHP (or MySQL, or Apache).
>
> A reply to an earlier poster read:
> ==
> It sounds like the MySQL extension module isn't loading. Here are some
> things to confirm:
>  - Ensure the module is declared in your php.ini file
>  - If it exists in the php.ini, confirm the module is located and named
>as stated in the php.ini file.
>  - If the module is named and located in the proper place, check your
>permissions on that extension. You want to make sure whatever is running
>your site can access the module.
> ===
> I've tried obeying the above instructions, with no luck. I'm also confused
> by
> the lines in php.ini:
>
> 
> ; Note: packaged extension modules are now loaded via the .ini files
> ; found in the directory /etc/php.d; these are loaded by default.
> 
>
> As guides, I initially used the following two pages:
>
> http://forums.fedoraforum.org/showthread.php?t=94257   (Title: Every
> server setup imaginable)
> http://www.somacon.com/p109.php  (Title: Resolving a Fatal error: Call
> to undefined function
>  mysql_connect() in RedHat)
> and have been reading the PHP and MySQL documentation.
>
> As per the Fedora Forum thread, I have executed:
>yum install php httpd system-config-httpd mod_ssl
> as well as:
>yum install mysql-server mysql mysql-gui-tools
> and:
>yum install php-mysql
>
> I've also tried altering /etc/php.ini with
>extension_dir = "/usr/lib64/php/modules/"
> which is where my mysql.so is found, and
>extension=mysql.so
>
> The output of my phpinfo() includes:
>
> mysql
>
> MySQL Support enabled
> Active Persistent Links   0
> Active Links  0
> Client API version5.1.42
> MYSQL_MODULE_TYPE external
> MYSQL_SOCKET  /var/lib/mysql/mysql.sock
> MYSQL_INCLUDE-I/usr/include/mysql
> MYSQL_LIBS   -L/usr/lib64/mysql -lmysqlclient
>
> Directive   Local Value   Master Value
> mysql.allow_local_infileOnOn
> mysql.allow_persistent  OnOn
> mysql.connect_timeout   6060
> mysql.default_host  no value  no value
> mysql.default_password  no value  no value
> mysql.default_port  no value  no value
> mysql.default_socket/var/lib/mysql/mysql.sock
> /var/lib/mysql/mysql.sock
> mysql.default_user  no value  no value
> mysql.max_links Unlimited Unlimited
> mysql.max_persistentUnlimited Unlimited
> mysql.trace_modeOff   Off
>
>
> mysqli
>
> MysqlI Support  enabled
> Client API library version  5.1.42
> Active Persistent Links 0
> Inactive Persistent Links   0
> Active Links0
> Client API header version   5.1.39
> MYSQLI_SOCKET   /var/lib/mysql/mysql.sock
>
> Directive  Local ValueMaster Value
> mysqli.allow_local_infile  On On
> mysqli.allow_persistentOn On
> mysqli.default_hostno value   n

[PHP-DB] 64-bit Linux -- Fatal ... undefined function mysql_connect()

2010-03-01 Thread andrew jarcho
Hello all,

I'm running Fedora 12 (64-bit), Apache 2.2.14, PHP 5.3.1, MySQL
5.1.42, on a Dell laptop.

I'm trying to access a local MySQL database using PHP. When I execute
this code from the shell (as: php testcode.php)



I get the message:

Fatal error: Call to undefined function mysql_connect()

The FAQ on the PHP site says:

"Unix users, at least the ones who know what they are doing, tend to
always build PHP against their system's
libmysqlclient library simply by adding the --with-mysql=/usr option
when building PHP."

But I'd like to avoid compiling PHP from source. I've had endless
trouble getting non-rpm code to play nice with
this 64-bit distro of Fedora. Also, I don't want to wind up with
multiple copies of PHP (or MySQL, or Apache).

A reply to an earlier poster read:
==
It sounds like the MySQL extension module isn't loading. Here are some
things to confirm:
  - Ensure the module is declared in your php.ini file
  - If it exists in the php.ini, confirm the module is located and named
as stated in the php.ini file.
  - If the module is named and located in the proper place, check your
permissions on that extension. You want to make sure whatever is running
your site can access the module.
===
I've tried obeying the above instructions, with no luck. I'm also confused by
the lines in php.ini:


; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.


As guides, I initially used the following two pages:

http://forums.fedoraforum.org/showthread.php?t=94257   (Title: Every
server setup imaginable)
http://www.somacon.com/p109.php  (Title: Resolving a Fatal error: Call
to undefined function
  mysql_connect() in RedHat)
and have been reading the PHP and MySQL documentation.

As per the Fedora Forum thread, I have executed:
yum install php httpd system-config-httpd mod_ssl
as well as:
yum install mysql-server mysql mysql-gui-tools
and:
yum install php-mysql

I've also tried altering /etc/php.ini with
extension_dir = "/usr/lib64/php/modules/"
which is where my mysql.so is found, and
extension=mysql.so

The output of my phpinfo() includes:

mysql

MySQL Support enabled
Active Persistent Links   0
Active Links  0
Client API version5.1.42
MYSQL_MODULE_TYPE external
MYSQL_SOCKET  /var/lib/mysql/mysql.sock
MYSQL_INCLUDE-I/usr/include/mysql
MYSQL_LIBS   -L/usr/lib64/mysql -lmysqlclient

Directive   Local Value   Master Value
mysql.allow_local_infileOnOn
mysql.allow_persistent  OnOn
mysql.connect_timeout   6060
mysql.default_host  no value  no value
mysql.default_password  no value  no value
mysql.default_port  no value  no value
mysql.default_socket/var/lib/mysql/mysql.sock   
/var/lib/mysql/mysql.sock
mysql.default_user  no value  no value
mysql.max_links Unlimited Unlimited
mysql.max_persistentUnlimited Unlimited
mysql.trace_modeOff   Off


mysqli

MysqlI Support  enabled
Client API library version  5.1.42
Active Persistent Links 0
Inactive Persistent Links   0
Active Links0
Client API header version   5.1.39
MYSQLI_SOCKET   /var/lib/mysql/mysql.sock

Directive  Local ValueMaster Value
mysqli.allow_local_infile  On On
mysqli.allow_persistentOn On
mysqli.default_hostno value   no value
mysqli.default_port3306   3306
mysqli.default_pw  no value   no value
mysqli.default_socket  no value   no value
mysqli.default_userno value   no value
mysqli.max_links   Unlimited  Unlimited
mysqli.max_persistent  Unlimited  Unlimited
mysqli.reconnect   OffOff

I'm just about out of ideas. The website I'm building will be strictly
local, for learning MySQL and PHP.

Can anybody help?

Thanks in advance...

Andy

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php