PHP & mySQL

Shawn Coomey yellowdog-general@lists.terrasoftsolutions.com
Sun Jun 23 10:16:01 2002


--Apple-Mail-1--702800138
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

Zack-

Sounds to me like PHP wasn't compiled with MySQL support. You can see if 
this works as a quick fix: Put the following line at the top of your PHP 
page:

dl("mysql.so");

If you are able to connect after that, then we can safely bet that PHP 
needs to be recompiled "--with-mysql" and "--with-apxs"

Of course, If you can live with putting dl("mysql.so") at the top of 
every page that use MySQL functions, you won't need to recompile.


Shawn


dl("mysql.so");
On Sunday, June 23, 2002, at 11:21 AM, Jamey Osborne wrote:

> At 12:40 AM 6/23/2002 -0400, you wrote:
>> Your quick response is appreciated! I tried other forums, and noone 
>> had a remote clue...(not that I did either..but you know..)
>>
>> I added those lines to php.ini & restarted httpd, and I still get the 
>> error:
>>
>> Call to undefined function: mysql_connect()
>>
>> Is there something I missed?
>
> Well, just taking a weak stab in the dark.  Without my manuals in front 
> of me, either...
>
> As I recall, don't you have to specify the database to be used in the 
> mysql_connect?  I didn't see that in your $Link line.  You're calling 
> the DB before you've specified it......
>
> ?
>
> Jamey Osborne
>
>
>> Thanks in advance..
>>
>> -Z
>>
>> mysql_connect
>> Blake Skinner <malice@mac.com> wrote:
>>
>> >The default install of PHP included with YDL does not function 
>> properly
>> >when MySQL or Postgresql calls are made to it. All the problems lie in
>> >the php.ini file so open this file in your favorite editor and search
>> >for "extension_dir".
>> >Change the line to:
>> >    extension_dir = /usr/lib/php4
>> >
>> >Next, search for extension until you come to the following section:
>> >    ;;;;;;;;;;;;;;;;;;;;;;
>> >    ; Dynamic Extensions ;
>> >    ;;;;;;;;;;;;;;;;;;;;;;
>> >    ;
>> >
>> >insert the following:
>> >
>> >    ; Unix Extensions
>> >    extension=imap.so
>> >    extension=ldap.so
>> >    extension=odbc.so
>> >    extension=pgsql.so
>> >    extension=mysql.so
>> >
>> >Finally, restart httpd (service httpd restart)
>> >
>> >On Saturday, June 22, 2002, at 06:34  PM, Zack wrote:
>> >
>> >> I get an odd error message in when I attempt to use mysql_connect 
>> in a
>> >> php script:
>> >>
>> >> Fatal error: Call to undefined function: mysql_connect() in
>> >> /home/sherlock/public_html/newsite/blah2.php on line 16
>> >>
>> >> Here is my php code, which has worked on other servers before:
>> >>
>> >> <?php
>> >> // Set the variables for the database access:
>> >> $Host = "localhost";
>> >> $User = "root";
>> >> $Password = "<not displayed";
>> >> $DBName = "sherlock";
>> >> $TableName = "property";
>> >>
>> >> $Link = mysql_connect ($Host, $User, $Password) or die
>> ( mysql_error() );
>> >> $Query = "SELECT * from $TableName";
>> >> $Result = mysql_db_query ($DBName, $Query, $Link) or die
>> >> ( mysql_error() );
>> >> ?>
>> >>
>> >>
>> >> To install Apache, mySQL, & PHP, I used "apt-get install apache 
>> mysql
>> >> php" which downloaded and installed the appropriate packages.
>> >>
>> >> I have enabled mysql support in both php.ini and httpd.conf.
>> >>
>> >> All other PHP functions, including writing to a text file, seem to
>> >> function just fine.
>> >>
>> >> I have even reinstalled Apache, mySQL & PHP.
>> >>
>> >> Anyone have any idea why mysql_connect AND mysql_pconnect would 
>> return
>> >> as an undefined function? Its as if PHP has no idea what a mysql
>> >> database is, even though it has built in support for it.
>> >>
>> >> Any help is greatly appreciated, and I thank you in advance.
>> >>
>> >> And yes, this is running on Yellow Dog Linux 2.2
>> >>
>> >> Thanks,
>> >>
>> >> -Z
>
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general@lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
>

--Apple-Mail-1--702800138
Content-Transfer-Encoding: 7bit
Content-Type: text/enriched;
	charset=US-ASCII

Zack-


Sounds to me like PHP wasn't compiled with MySQL support. You can see
if this works as a quick fix: Put the following line at the top of
your PHP page:


dl("mysql.so");


If you are able to connect after that, then we can safely bet that PHP
needs to be recompiled "--with-mysql" and "--with-apxs"


Of course, If you can live with putting dl("mysql.so") at the top of
every page that use MySQL functions, you won't need to recompile.



Shawn

<fixed><fontfamily><param>Courier New</param>


dl("mysql.so");</fontfamily></fixed>

On Sunday, June 23, 2002, at 11:21 AM, Jamey Osborne wrote:


<excerpt>At 12:40 AM 6/23/2002 -0400, you wrote:

<excerpt>Your quick response is appreciated! I tried other forums, and
noone had a remote clue...(not that I did either..but you know..)


I added those lines to php.ini & restarted httpd, and I still get the
error:


Call to undefined function: mysql_connect()


Is there something I missed?

</excerpt>

Well, just taking a weak stab in the dark.  Without my manuals in
front of me, either...


As I recall, don't you have to specify the database to be used in the
mysql_connect?  I didn't see that in your $Link line.  You're calling
the DB before you've specified it......


?


Jamey Osborne



<excerpt>Thanks in advance..


-Z


mysql_connect

Blake Skinner <<malice@mac.com> wrote:


>The default install of PHP included with YDL does not function
properly

>when MySQL or Postgresql calls are made to it. All the problems lie in

>the php.ini file so open this file in your favorite editor and search

>for "extension_dir".

>Change the line to:

>    extension_dir = /usr/lib/php4

>

>Next, search for extension until you come to the following section:

>    ;;;;;;;;;;;;;;;;;;;;;;

>    ; Dynamic Extensions ;

>    ;;;;;;;;;;;;;;;;;;;;;;

>    ;

>

>insert the following:

>

>    ; Unix Extensions

>    extension=imap.so

>    extension=ldap.so

>    extension=odbc.so

>    extension=pgsql.so

>    extension=mysql.so

>

>Finally, restart httpd (service httpd restart)

>

>On Saturday, June 22, 2002, at 06:34  PM, Zack wrote:

>

>> I get an odd error message in when I attempt to use mysql_connect
in a

>> php script:

>>

>> Fatal error: Call to undefined function: mysql_connect() in

>> /home/sherlock/public_html/newsite/blah2.php on line 16

>>

>> Here is my php code, which has worked on other servers before:

>>

>> <<?php

>> // Set the variables for the database access:

>> $Host = "localhost";

>> $User = "root";

>> $Password = "<<not displayed";

>> $DBName = "sherlock";

>> $TableName = "property";

>>

>> $Link = mysql_connect ($Host, $User, $Password) or die(
mysql_error() );

>> $Query = "SELECT * from $TableName";

>> $Result = mysql_db_query ($DBName, $Query, $Link) or die

>> ( mysql_error() );

>> ?>

>>

>>

>> To install Apache, mySQL, & PHP, I used "apt-get install apache
mysql

>> php" which downloaded and installed the appropriate packages.

>>

>> I have enabled mysql support in both php.ini and httpd.conf.

>>

>> All other PHP functions, including writing to a text file, seem to

>> function just fine.

>>

>> I have even reinstalled Apache, mySQL & PHP.

>>

>> Anyone have any idea why mysql_connect AND mysql_pconnect would
return

>> as an undefined function? Its as if PHP has no idea what a mysql

>> database is, even though it has built in support for it.

>>

>> Any help is greatly appreciated, and I thank you in advance.

>>

>> And yes, this is running on Yellow Dog Linux 2.2

>>

>> Thanks,

>>

>> -Z

</excerpt>

_______________________________________________

yellowdog-general mailing list

yellowdog-general@lists.terrasoftsolutions.com

http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general


</excerpt>
--Apple-Mail-1--702800138--