Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-18 Thread Mark Rees
Linda H [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I added the following to the top of my script:

 ?php
echo phpinfo();
 ?

 Got all sorts of environment and path info. Not anything about MySQL, but
I
 didn't see anything that looked obviously wrong, though I don't understand
 a lot of it.

 I ried reinstalling MySQL, Apache, and PHP. No change.

 Linda

What does php.ini have for this line

display_errors = On

If it's off, set it on.

Mark

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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-18 Thread kalinga
i recently met samekind of problem, could you pls specify the
OS, Apache, Php and MySQL vesrions you are using?

vk

On 7/18/05, Mark Rees [EMAIL PROTECTED] wrote:
 Linda H [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  I added the following to the top of my script:
 
  ?php
 echo phpinfo();
  ?
 
  Got all sorts of environment and path info. Not anything about MySQL, but
 I
  didn't see anything that looked obviously wrong, though I don't understand
  a lot of it.
 
  I ried reinstalling MySQL, Apache, and PHP. No change.
 
  Linda
 
 What does php.ini have for this line
 
 display_errors = On
 
 If it's off, set it on.
 
 Mark
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
vk.

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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-18 Thread Rick Emery

Quoting Linda H [EMAIL PROTECTED]:


I added the following to the top of my script:

?php
  echo phpinfo();
?

Got all sorts of environment and path info.


In addition to the other excellent suggestions so far, make sure 
(looking at the phpinfo page, under Configuration File Path) that 
your install is using the php.ini file you think it is. I got bit by 
this (I kept editing the php.ini file in one directory, but it was 
reading the file from another).


It really does sound like error reporting is turned off.

hth,
Rick


--
Rick Emery

When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return
 -- Leonardo Da Vinci

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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-18 Thread Linda H
For those who didn't join this thread at the beginning, I'm running MySQL 
4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system.


I installed in the sequence - MySQL, then Apache, then PHP. MySQL was 
running when the others were installed (which is what the book I am using 
seemed to indicate). Apache was not running when PHP was installed.



What does php.ini have for this line
display_errors = On


Now we are getting somewhere. Even though error_reporting was set to E_ALL, 
display_errors was Off. I set it On and now I'm getting an error.


Fatal error: Call to undefined function mysql_connect() in C:\Program 
Files\Apache Group\Apache2\htdocs\example\test_connect.php on line 15


the phpinfo() display doesn't reference MySQL at all. It does reference 
SQLite with the following info:


SQLite supportenabled:
PECL Module version 2.0-dev $Id: sqlite.c,v 1.146.2.2 2004/08/02 22:43:42 
iliaa Exp $

SQLite Library: 2.8.14
SQLite Encoding: iso8859

Directive: sqlite_assoc_case, Local Value: 0, Master Value: 0

So it looks like MySQL didn't get configured with PHP.

In the PHP FAQ on database issues, I found the following:


4. PHP 5 no longer bundles MySQL client libraries, what does this mean to 
me? Can I still use MySQL with PHP? I try to use MySQL and get function 
undefined errors, what gives?


Yes. There will always be MySQL support in PHP of one kind or another. The 
only change in PHP 5 is that we are no longer bundling the client library 
itself. Some reasons in no particular order:

   * Most systems these days already have the client library installed.
   * Given the above, having multiple versions of the library can get 
messy. For example, if you link mod_auth_mysql against one version and PHP 
against another, and then enable both in Apache, you get a nice fat crash. 
Also, the bundled library didn't always play well with the installed server 
version. The most obvious symptom of this being disagreement over where to 
find the mysql.socket Unix domain socket file.
   * Maintenance was somewhat lax and it was falling further and further 
behind the released version.
   * Future versions of the library are under the GPL and thus we don't 
have an upgrade path since we cannot bundle a GPL'ed library in a 
BSD/Apache-style licensed project. A clean break in PHP 5 seemed like the 
best option.


This won't actually affect that many people. Unix users, at least the ones 
who know what they are doing, tend to always build PHP against their 
system's libmyqlclient library simply by adding the --with-mysql=/usr 
option when building PHP. Windows users may enable the extension 
php_mysql.dll inside php.ini. Also, be sure libmysql.dll is available to 
the systems PATH. For more details on how, read the FAQ on 
http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopathsetting 
up the Windows systems PATH. Because libmysql.dll (and many other PHP 
related files) exist in the PHP folder, you'll want to add the PHP folder 
to your systems PATH.


I added my PHP folder (C:\php5\) to my system path and restarted 
(libmysql.ddl is in php5). Still get the error. I enabled the extension 
php_mysql.dll in php.ini and Apache startup says it can't find it 
(php_mysql.dll is in C:\php5\ext).


So, should I move php_mysql.dll to c:\php5, change the system path, or 
what? And what about php.ini showing sqlite instead of MySQL? Do I need to 
get the MySQL client libraries (what are they called and where do I put 
them - I already have some mysql dll's in the PHP libraries.


Linda

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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-18 Thread Mark Rees
Linda H [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 For those who didn't join this thread at the beginning, I'm running MySQL
 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP system.

 I installed in the sequence - MySQL, then Apache, then PHP. MySQL was
 running when the others were installed (which is what the book I am using
 seemed to indicate). Apache was not running when PHP was installed.

 What does php.ini have for this line
 display_errors = On

 Now we are getting somewhere. Even though error_reporting was set to
E_ALL,
 display_errors was Off. I set it On and now I'm getting an error.

 Fatal error: Call to undefined function mysql_connect() in C:\Program
 Files\Apache Group\Apache2\htdocs\example\test_connect.php on line 15

 the phpinfo() display doesn't reference MySQL at all. It does reference
 SQLite with the following info:

 SQLite supportenabled:
 PECL Module version 2.0-dev $Id: sqlite.c,v 1.146.2.2 2004/08/02 22:43:42
 iliaa Exp $
 SQLite Library: 2.8.14
 SQLite Encoding: iso8859

 Directive: sqlite_assoc_case, Local Value: 0, Master Value: 0

 So it looks like MySQL didn't get configured with PHP.

 In the PHP FAQ on database issues, I found the following:

 
 4. PHP 5 no longer bundles MySQL client libraries, what does this mean to
 me? Can I still use MySQL with PHP? I try to use MySQL and get function
 undefined errors, what gives?

 Yes. There will always be MySQL support in PHP of one kind or another. The
 only change in PHP 5 is that we are no longer bundling the client library
 itself. Some reasons in no particular order:
 * Most systems these days already have the client library installed.
 * Given the above, having multiple versions of the library can get
 messy. For example, if you link mod_auth_mysql against one version and PHP
 against another, and then enable both in Apache, you get a nice fat crash.
 Also, the bundled library didn't always play well with the installed
server
 version. The most obvious symptom of this being disagreement over where to
 find the mysql.socket Unix domain socket file.
 * Maintenance was somewhat lax and it was falling further and further
 behind the released version.
 * Future versions of the library are under the GPL and thus we don't
 have an upgrade path since we cannot bundle a GPL'ed library in a
 BSD/Apache-style licensed project. A clean break in PHP 5 seemed like the
 best option.

 This won't actually affect that many people. Unix users, at least the ones
 who know what they are doing, tend to always build PHP against their
 system's libmyqlclient library simply by adding the --with-mysql=/usr
 option when building PHP. Windows users may enable the extension
 php_mysql.dll inside php.ini. Also, be sure libmysql.dll is available to
 the systems PATH. For more details on how, read the FAQ on

http://www.php.net/manual/en/faq.installation.php#faq.installation.addtopat
hsetting
 up the Windows systems PATH. Because libmysql.dll (and many other PHP
 related files) exist in the PHP folder, you'll want to add the PHP folder
 to your systems PATH.

 I added my PHP folder (C:\php5\) to my system path and restarted
 (libmysql.ddl is in php5). Still get the error. I enabled the extension
 php_mysql.dll in php.ini and Apache startup says it can't find it
 (php_mysql.dll is in C:\php5\ext).

Make sure this is set as follows in php.ini, then restart apache

extension_dir = c:\php\ext


 So, should I move php_mysql.dll to c:\php5, change the system path, or
 what? And what about php.ini showing sqlite instead of MySQL? Do I need to
 get the MySQL client libraries (what are they called and where do I put
 them - I already have some mysql dll's in the PHP libraries.

 Linda

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



[PHP] Re: Need help with PHP / MySQL connect problem

2005-07-17 Thread Linda H

Thanks for the advice, Matt, but it doesn't seem to solve my problem.

php.ini is in the C:Program Files/WINDOWS directory and error_reporting was 
set to E_ALL.


I found php5ts.dll in the WINDOWS/system32 directory. I copied it to 
WINDOWS/system, just in case. My install instructions said to put it with 
my other dlls, which might be in either directory. Most of them are in 
system32.



Using this at the top of your script will allow PHP and MySQL to interact.
$_POST['dbconn']=mysql_select_db(database_name, 
mysql_connect(server_name,user_name,password));


I put this in my script (changing parameters as appropriate) but got no 
results and no error messages. Any other ideas. I've spent hours on this, 
trying everything I could think of and I'm very frustrated.


The rest of my output is still suppressed if I put the connect script above 
it in the file.



It does sound like you have notices and warnings turned off in php.ini:
Find php.ini (not sure where it installs to in Windows version), and set 
error_reporting  = E_ALL.
This will show all notices and warnings generated by your PHP code; 
extremely usefull in debugging.


Matt Darby

Linda H wrote:

I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows XP 
system. I can run scripts with PHP and HTML statements and see correct 
output in my browser. But when I try to connect to MySQL I get nothing, 
including no error messages.


One book I have says to run the following scrip to test the connection. 
It should print either the Resource name or an error message:


?php
  echo mysql_connect ('localhost','calendar','pass1234');  # host, user, 
password

?

I get no output at all, and if the statement is placed in a larger 
script, above html/PHP output, it suppresses that as well.


Using the mysql monitor from the DOS command prompt, I can connect as 
user 'calendar' with password 'pass1234', select a database and execute 
SQL statements successfully.


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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-17 Thread Matt Darby

Try this just for kicks:

?
   aslkdjfalsd;
?

See if this will output errors. It's rather hard to debug without error 
messages ;)

If I remember correctly, isn't php.ini supposed to be in c:/PHP?

Linda H wrote:


Thanks for the advice, Matt, but it doesn't seem to solve my problem.

php.ini is in the C:Program Files/WINDOWS directory and 
error_reporting was set to E_ALL.


I found php5ts.dll in the WINDOWS/system32 directory. I copied it to 
WINDOWS/system, just in case. My install instructions said to put it 
with my other dlls, which might be in either directory. Most of them 
are in system32.


Using this at the top of your script will allow PHP and MySQL to 
interact.
$_POST['dbconn']=mysql_select_db(database_name, 
mysql_connect(server_name,user_name,password));



I put this in my script (changing parameters as appropriate) but got 
no results and no error messages. Any other ideas. I've spent hours on 
this, trying everything I could think of and I'm very frustrated.


The rest of my output is still suppressed if I put the connect script 
above it in the file.



It does sound like you have notices and warnings turned off in php.ini:
Find php.ini (not sure where it installs to in Windows version), and 
set error_reporting  = E_ALL.
This will show all notices and warnings generated by your PHP code; 
extremely usefull in debugging.


Matt Darby

Linda H wrote:

I'm running MySQL 4.0.21, Apache 2.0.52 and PHP 5.0.2 on a Windows 
XP system. I can run scripts with PHP and HTML statements and see 
correct output in my browser. But when I try to connect to MySQL I 
get nothing, including no error messages.


One book I have says to run the following scrip to test the 
connection. It should print either the Resource name or an error 
message:


?php
  echo mysql_connect ('localhost','calendar','pass1234');  # host, 
user, password

?

I get no output at all, and if the statement is placed in a larger 
script, above html/PHP output, it suppresses that as well.


Using the mysql monitor from the DOS command prompt, I can connect 
as user 'calendar' with password 'pass1234', select a database and 
execute SQL statements successfully.






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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-17 Thread Linda H



Try this just for kicks:

?
   aslkdjfalsd;
?


Nope - nothing :-(

See if this will output errors. It's rather hard to debug without error 
messages ;)


No kidding!


If I remember correctly, isn't php.ini supposed to be in c:/PHP?


It came in c:/php5 as php.ini-recommended. My instructions were to move it 
to c:\WINDOWS and rename to php.ini.


Linda

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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-17 Thread Linda H

I added the following to the top of my script:

?php
  echo phpinfo();
?

Got all sorts of environment and path info. Not anything about MySQL, but I 
didn't see anything that looked obviously wrong, though I don't understand 
a lot of it.


I ried reinstalling MySQL, Apache, and PHP. No change.

Linda 


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



Re: [PHP] Re: Need help with PHP / MySQL connect problem

2005-07-17 Thread Matt Darby

You should definitely see a listing for MySQL in phpinfo()...
What order did you install MySQL/PHP/Apache?

Linda H wrote:


I added the following to the top of my script:

?php
  echo phpinfo();
?

Got all sorts of environment and path info. Not anything about MySQL, 
but I didn't see anything that looked obviously wrong, though I don't 
understand a lot of it.


I ried reinstalling MySQL, Apache, and PHP. No change.

Linda


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