Running PHP 5.1.2; MySQL installed, but not 'seen'

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

lorikay4
Forum Newbie
Posts: 18
Joined: Fri Jan 05, 2007 6:57 pm

Post by lorikay4 »

I just installed the MySQL Admin GUI tool. It says my server instance is up and running, and I'm using version 5.0.27. So yes it's installed and running. I just don't know how to make PHP see it. :evil:
lorikay4
Forum Newbie
Posts: 18
Joined: Fri Jan 05, 2007 6:57 pm

Post by lorikay4 »

Everah, I did install the GUI Admin tool, and I did read this: http://us2.php.net/mysql#mysql.installation.windows about installing the MySQL extension on windows, and I will be honest, I don't understand what I'm supposed to do. It talks about things I don't understand.

For example, can someone tell me the EXACT syntax for the statement that tells PHP where to find the MySQL extension? I have:

extension_dir = c:\php\ext

is this correct? I have no idea.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

That extension dir looks correct. Are there DLL files in that folder? Is there a php_mysql (or some other name variant) in that folder? Is that the same name as the one in the php.ini file? Are the permission correct on that folder?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://de3.php.net/manual/en/ref.mysql. ... stallation on Windows Systems
...
PHP 5+[/quote]Did you follow these steps? If you did, exactly what did you do to libmysql.dll?
lorikay4
Forum Newbie
Posts: 18
Joined: Fri Jan 05, 2007 6:57 pm

Post by lorikay4 »

Yes there are .dll files in that folder (C:\php\ext), and among them is php_mysql.dll.

Yes, it is the same file name as referenced in the php.ini statement.

I don't know how to change permissions, but this is all happening on my own local laptop, of which I am the administrator, so I have never had to change any permissions to do local stuff. I own all the files, as far as I know.

And also, I did add my php directory to the windows path variable, and still my php installation doesn't see or believe in or talk nicely to the MySQL installation.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

This is one odd problem.

Can you appease me with something? Can you check your server error logs really quick and see if there is anything in them? I was having an issue once with enabling an extensions and the error logs told me a good deal of information.
lorikay4
Forum Newbie
Posts: 18
Joined: Fri Jan 05, 2007 6:57 pm

Post by lorikay4 »

I would love it if the page you reference in the PHP documentation, http://de3.php.net/manual/en/ref.mysql.php, did in fact list specific, well-defined steps.

Right now a copy of the file libmysql.dll is located in c:/php, and since that directory value is included in my windows PATH statement, it should be able to be found by php.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Please post the output of

Code: Select all

<?php
function fileperm($path) {
	if ( !file_exists($path) ) {
		echo '-no such file-';
	}
	else {
		echo is_dir($path) ? 'd':'-';	
		echo is_readable($path) ? 'r':'-';
		echo is_writable($path) ? 'w':'-';
		echo is_executable($path) ? 'x':'-';
	}
}

$phpini = trim(get_cfg_var('cfg_file_path'));
if ( 0==strlen($phpini) ) {
	die('no php.ini');
}

echo 'ini: ', $phpini, ' perm: ', fileperm($phpini), "<br />\n";
$lookingFor = array('php_mysql', 'extension_dir');
$config = file($phpini);
echo "-- ini parameters --<br />\n";
foreach($config as $l) {
	foreach($lookingFor as $s) {
		if ( false!==strpos($l, $s) ) {
			echo ' ', nl2br($l);
		}
	}
}
echo "-- parameter test --<br />\n";
$extdir = str_replace('\\', '/', get_cfg_var('extension_dir'));
if ( '/'!=substr($extdir, -1, 1) ) {
	$extdir .= '/';
}
$pattern = '!^extension\s*=\s*(.+)$!';
foreach($config as $l) {
	if ( preg_match($pattern, $l, $m) ) {
		$ext = $extdir . trim($m[1]);
		echo ' ', $ext, ' perm: ', fileperm($ext), "<br />\n";
	}
}

echo "-- PATH test --<br />\n";
$path = getenv('PATH');
echo ' path: ', $path, "<br />\n";
foreach( explode(';', $path) as $p) {
	$p = str_replace('\\', '/', $p);	
	if ( '/'!=substr($p, -1, 1) ) {
		$p .= '/';
	}	
	$p .= 'libmysql.dll';
	echo ' ', $p, ' perm: ', fileperm($p), "<br />\n";
}
the script doesn't change anything. It tries to read some config parameter (php.ini, PATH, ...).
lorikay4
Forum Newbie
Posts: 18
Joined: Fri Jan 05, 2007 6:57 pm

Post by lorikay4 »

Everah --

Today's apache logfile:

[Mon Jan 08 09:18:28 2007] [warn] pid file C:/Program Files/Apache Group/Apache2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Jan 08 09:18:28 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 09:18:28 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 09:18:28 2007] [notice] Parent: Created child process 1788
[Mon Jan 08 09:18:28 2007] [notice] Child 1788: Child process is running
[Mon Jan 08 09:18:28 2007] [notice] Child 1788: Acquired the start mutex.
[Mon Jan 08 09:18:28 2007] [notice] Child 1788: Starting 250 worker threads.
[Mon Jan 08 10:41:44 2007] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Jan 08 10:41:44 2007] [notice] Child 1788: Exit event signaled. Child process is ending.
[Mon Jan 08 10:41:45 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 10:41:45 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 10:41:45 2007] [notice] Parent: Created child process 3996
[Mon Jan 08 10:41:45 2007] [notice] Child 1788: Released the start mutex
[Mon Jan 08 10:41:45 2007] [notice] Child 3996: Child process is running
[Mon Jan 08 10:41:45 2007] [notice] Child 3996: Acquired the start mutex.
[Mon Jan 08 10:41:45 2007] [notice] Child 3996: Starting 250 worker threads.
[Mon Jan 08 10:41:46 2007] [notice] Child 1788: Waiting for 250 worker threads to exit.
[Mon Jan 08 10:41:46 2007] [notice] Child 1788: All worker threads have exited.
[Mon Jan 08 10:41:46 2007] [notice] Child 1788: Child process is exiting
[Mon Jan 08 12:35:35 2007] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Jan 08 12:35:36 2007] [notice] Child 3996: Exit event signaled. Child process is ending.
[Mon Jan 08 12:35:37 2007] [notice] Child 3996: Released the start mutex
[Mon Jan 08 12:35:43 2007] [notice] Child 3996: Waiting for 250 worker threads to exit.
[Mon Jan 08 12:35:43 2007] [notice] Child 3996: All worker threads have exited.
[Mon Jan 08 12:35:43 2007] [notice] Child 3996: Child process is exiting
[Mon Jan 08 12:35:44 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 12:35:44 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 12:35:45 2007] [notice] Parent: Created child process 5220
[Mon Jan 08 12:35:46 2007] [notice] Child 5220: Child process is running
[Mon Jan 08 12:35:46 2007] [notice] Child 5220: Acquired the start mutex.
[Mon Jan 08 12:35:46 2007] [notice] Child 5220: Starting 250 worker threads.
[Mon Jan 08 12:44:40 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 12:44:40 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 12:44:40 2007] [notice] Parent: Created child process 360
[Mon Jan 08 12:44:40 2007] [notice] Child 360: Child process is running
[Mon Jan 08 12:44:40 2007] [notice] Child 360: Acquired the start mutex.
[Mon Jan 08 12:44:40 2007] [notice] Child 360: Starting 250 worker threads.
[Mon Jan 08 14:02:12 2007] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Jan 08 14:02:12 2007] [notice] Child 360: Exit event signaled. Child process is ending.
[Mon Jan 08 14:02:13 2007] [notice] Child 360: Released the start mutex
[Mon Jan 08 14:02:14 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 14:02:14 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 14:02:14 2007] [notice] Parent: Created child process 5688
[Mon Jan 08 14:02:14 2007] [notice] Child 360: Waiting for 250 worker threads to exit.
[Mon Jan 08 14:02:15 2007] [notice] Child 5688: Child process is running
[Mon Jan 08 14:02:15 2007] [notice] Child 5688: Acquired the start mutex.
[Mon Jan 08 14:02:15 2007] [notice] Child 5688: Starting 250 worker threads.
[Mon Jan 08 14:02:18 2007] [notice] Child 360: All worker threads have exited.
[Mon Jan 08 14:02:18 2007] [notice] Child 360: Child process is exiting
[Mon Jan 08 14:19:07 2007] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Jan 08 14:19:07 2007] [notice] Child 5688: Exit event signaled. Child process is ending.
[Mon Jan 08 14:19:08 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 14:19:08 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 14:19:08 2007] [notice] Parent: Created child process 4616
[Mon Jan 08 14:19:08 2007] [notice] Child 4616: Child process is running
[Mon Jan 08 14:19:08 2007] [notice] Child 5688: Released the start mutex
[Mon Jan 08 14:19:08 2007] [notice] Child 4616: Acquired the start mutex.
[Mon Jan 08 14:19:09 2007] [notice] Child 4616: Starting 250 worker threads.
[Mon Jan 08 14:19:10 2007] [notice] Child 5688: Waiting for 250 worker threads to exit.
[Mon Jan 08 14:19:13 2007] [notice] Child 5688: All worker threads have exited.
[Mon Jan 08 14:19:13 2007] [notice] Child 5688: Child process is exiting
[Mon Jan 08 14:20:09 2007] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Jan 08 14:20:09 2007] [notice] Child 4616: Exit event signaled. Child process is ending.
[Mon Jan 08 14:20:09 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 14:20:09 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 14:20:09 2007] [notice] Parent: Created child process 4180
[Mon Jan 08 14:20:09 2007] [notice] Child 4180: Child process is running
[Mon Jan 08 14:20:10 2007] [notice] Child 4180: Acquired the start mutex.
[Mon Jan 08 14:20:10 2007] [notice] Child 4616: Released the start mutex
[Mon Jan 08 14:20:10 2007] [notice] Child 4180: Starting 250 worker threads.
[Mon Jan 08 14:20:11 2007] [notice] Child 4616: Waiting for 250 worker threads to exit.
[Mon Jan 08 14:20:11 2007] [notice] Child 4616: All worker threads have exited.
[Mon Jan 08 14:20:11 2007] [notice] Child 4616: Child process is exiting
[Mon Jan 08 14:26:42 2007] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Jan 08 14:26:42 2007] [notice] Child 4180: Exit event signaled. Child process is ending.
[Mon Jan 08 14:26:42 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 14:26:42 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 14:26:43 2007] [notice] Parent: Created child process 5132
[Mon Jan 08 14:26:43 2007] [notice] Child 5132: Child process is running
[Mon Jan 08 14:26:43 2007] [notice] Child 4180: Released the start mutex
[Mon Jan 08 14:26:43 2007] [notice] Child 5132: Acquired the start mutex.
[Mon Jan 08 14:26:44 2007] [notice] Child 5132: Starting 250 worker threads.
[Mon Jan 08 14:26:45 2007] [notice] Child 4180: Waiting for 250 worker threads to exit.
[Mon Jan 08 14:26:45 2007] [notice] Child 4180: All worker threads have exited.
[Mon Jan 08 14:26:45 2007] [notice] Child 4180: Child process is exiting
[Mon Jan 08 14:36:22 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 14:36:22 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 14:36:22 2007] [notice] Parent: Created child process 6000
[Mon Jan 08 14:36:23 2007] [notice] Child 6000: Child process is running
[Mon Jan 08 14:36:23 2007] [notice] Child 6000: Acquired the start mutex.
[Mon Jan 08 14:36:23 2007] [notice] Child 6000: Starting 250 worker threads.
[Mon Jan 08 14:38:55 2007] [notice] Apache/2.0.55 (Win32) PHP/5.1.2 configured -- resuming normal operations
[Mon Jan 08 14:38:55 2007] [notice] Server built: Oct 9 2005 19:16:56
[Mon Jan 08 14:38:55 2007] [notice] Parent: Created child process 3624
[Mon Jan 08 14:38:55 2007] [notice] Child 3624: Child process is running
[Mon Jan 08 14:38:56 2007] [notice] Child 3624: Acquired the start mutex.
[Mon Jan 08 14:38:56 2007] [notice] Child 3624: Starting 250 worker threads.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The output of my script would still be nice ;)
lorikay4
Forum Newbie
Posts: 18
Joined: Fri Jan 05, 2007 6:57 pm

Post by lorikay4 »

volka -- it returns 'no php.ini'

but I do have a php.ini, located in c:\windows, and php itself has been running uncontroversially for almost a year. ?????

and the reason I hadn't posted the output was that I was writing a different post when you posted the script. I was not ignoring you.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

lorikay4 wrote:I was not ignoring you.
I didn't think so. Just pushing. "go go go" ;)
lorikay4 wrote:and php itself has been running uncontroversially for almost a year. ?????
php does not need a php.ini. All parameters have default values that are used if no config file was found (or could not be read).
http://de2.php.net/function.get_cfg_var wrote:To check whether the system is using a configuration file, try retrieving the value of the cfg_file_path configuration setting. If this is available, a configuration file is being used.
I'm quite sure the opposite is true as well: if it is not available no config file was used - never saw it any different.
What xp edition do you use? professional, home?
php is installed as apache module? Does your httpd.conf say anything about PHPIniDir ?
lorikay4
Forum Newbie
Posts: 18
Joined: Fri Jan 05, 2007 6:57 pm

Post by lorikay4 »

:-)

I am running XP Professional, Service Pack 2, and I run updates every day.
php is installed as apache module?
I have no idea.
Does your httpd.conf say anything about PHPIniDir ?
PHP appears in httpd.conf in the following block of lines:

PHPIniDir "C:/php"
LoadFile "C:/php/php5ts.dll"
LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php

Thanks![/quote]
lorikay4
Forum Newbie
Posts: 18
Joined: Fri Jan 05, 2007 6:57 pm

Post by lorikay4 »

And so the problem now seems to be telling PHP to SEE my php.ini file, is that correct? I have it in c:\windows, which one of the installation tutorials told me to do, I cannot remember which one. But the problem is, how do we tell PHP to LOOK 8O there?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

PHPIniDir "C:/php"
copy c:\windows\php.ini c:\php\php.ini
restart apache
try again
Post Reply