php-general Digest 5 Oct 2010 10:48:35 -0000 Issue 6974
Topics (messages 308450 through 308454):
Re: Connecting to MySql with PHP
308450 by: [email protected]
308451 by: mrfroasty
Bug #52782: DOMDocument subclass forgotten using ->ownerDocument after closure
308452 by: Jan Moesen
Filesystem path creation function
308453 by: Gary
Continuance of the struggle (trying to understand)
308454 by: Col Day
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Have you installed the php mysql module? Basically, it tells php how to connect
to mysql.
This question has come up a few times this week, have you tried installing
something like xampp or easyphp rather than the individual software components:
Apache, php & mysql.
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "sueandant" <[email protected]>
Date: Mon, Oct 4, 2010 22:08
Subject: [PHP] Connecting to MySql with PHP
To: <[email protected]>
I am running PHP 5.3.3, with Apache 2.0 Handler and MySql Server 5.1. My OS
is Vista Home Premium 32 bit with SP2.
MySql works fine from the command prompt, Apache is running and PHP works.
But I cannot access the mysqli classes. This simple program:
<?php
$mysqli = new mysqli("localhost", "root", "######", "testDB"); #I've
deliberately obliterated the password
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("Host information: %s\n", mysqli_get_host_info($mysqli));
}
?>
produces this error message:
Warning: mysqli::mysqli() [mysqli.mysqli]: [2002] A connection attempt failed
because the connected party did not (trying to connect via
tcp://localhost:3306) in C:\Apache\htdocs\mysqlconnect.php on line 3
Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2002): A connection attempt
failed because the connected party did not properly respond after a period of
time, or established connection failed because connected host has failed to
respond. in C:\Apache\htdocs\mysqlconnect.php on line 3
Fatal error: Maximum execution time of 30 seconds exceeded in
C:\Apache\htdocs\mysqlconnect.php on line 3
I guess PHP cannot find the mysqli classes. I've checked the phpinfo() output
and discovered :
Configuration File (php.ini) Path C:\Windows
Loaded Configuration File C:\PHP\php.ini
I don't know if this ok. I've tried changing the location of the loaded file
to C:\Windows\php.ini, but to no avail, and I don't know how to change the
location of the config file.
I am obviously doing something wrong, but I don't know what. Can anyone help?
Ironically, everything worked perfectly before I upgraded to PHP 5.3.3!
--- End Message ---
--- Begin Message ---
The code execute fine on my LAMP server, but I am wondering does
localhost really works on Windows ?As this on MAC you need to actually
tell a complete path.On MAC with Zend-Server I had to mention something
like /var/tmp/mysql ....
Anyways, by looking on the error it might be mysql server is not
accessed...Can you actually access the myql server with anything else
like phpmyadmin or cli ?
Gr
mrfroasty
On 10/04/2010 11:21 PM, [email protected] wrote:
> Have you installed the php mysql module? Basically, it tells php how to
> connect to mysql.
>
> This question has come up a few times this week, have you tried installing
> something like xampp or easyphp rather than the individual software
> components: Apache, php & mysql.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
> ----- Reply message -----
> From: "sueandant" <[email protected]>
> Date: Mon, Oct 4, 2010 22:08
> Subject: [PHP] Connecting to MySql with PHP
> To: <[email protected]>
>
> I am running PHP 5.3.3, with Apache 2.0 Handler and MySql Server 5.1. My OS
> is Vista Home Premium 32 bit with SP2.
>
> MySql works fine from the command prompt, Apache is running and PHP works.
> But I cannot access the mysqli classes. This simple program:
>
> <?php
>
> $mysqli = new mysqli("localhost", "root", "######", "testDB"); #I've
> deliberately obliterated the password
>
> if (mysqli_connect_errno()) {
> printf("Connect failed: %s\n", mysqli_connect_error());
> exit();
> } else {
> printf("Host information: %s\n", mysqli_get_host_info($mysqli));
> }
> ?>
>
> produces this error message:
>
> Warning: mysqli::mysqli() [mysqli.mysqli]: [2002] A connection attempt failed
> because the connected party did not (trying to connect via
> tcp://localhost:3306) in C:\Apache\htdocs\mysqlconnect.php on line 3
>
> Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2002): A connection attempt
> failed because the connected party did not properly respond after a period of
> time, or established connection failed because connected host has failed to
> respond. in C:\Apache\htdocs\mysqlconnect.php on line 3
>
> Fatal error: Maximum execution time of 30 seconds exceeded in
> C:\Apache\htdocs\mysqlconnect.php on line 3
>
> I guess PHP cannot find the mysqli classes. I've checked the phpinfo()
> output and discovered :
>
> Configuration File (php.ini) Path C:\Windows
> Loaded Configuration File C:\PHP\php.ini
>
>
> I don't know if this ok. I've tried changing the location of the loaded
> file to C:\Windows\php.ini, but to no avail, and I don't know how to change
> the location of the config file.
>
> I am obviously doing something wrong, but I don't know what. Can anyone
> help?
>
> Ironically, everything worked perfectly before I upgraded to PHP 5.3.3!
--
Extra details:
OSS:Gentoo Linux
profile:x86
Hardware:msi geforce 8600GT asus p5k-se
location:/home/muhsin
language(s):C/C++,VB,VHDL,bash,PHP,SQL,HTML,CSS
Typo:40WPM
url:http://www.mzalendo.net
url:http://www.zanbytes.com
--- End Message ---
--- Begin Message ---
(I filed bug #52782 about a month ago, but have not received any reply.
I am posting here to try and get some feedback on it.)
We have custom XML document and element classes that extend the original
DOMDocument and DOMElement classes for convenience. There is a class
that uses an instance of XmlElement obtained via a callback specified at
construction time. That XmlElement works fine and stays that way.
However, when we get its ownerDocument outside of the closure, the
result is not an XmlDocument but a DOMDocument. I cannot see a single
reason why.
I tried several options, and it only seems to happen with that closure.
I have checked versions 5.3.1, 5.3.2, 5.3.3 and now the latest 5.3.4
snapshot compiled with './configure && make'.
More details and a test case: http://bugs.php.net/bug.php?id=52782
Jan
--- End Message ---
--- Begin Message ---
Does such a thing exist in php? My searches have lead nowhere.
What I am looking for is a function which you would pass two parts of a
path to (which might be a directory and a filename, say) and it would
return a string containing the parameters separate by the correct number
of path separators according to the current OS.
For example:
<?php
$d = 'foo';
$f = 'bar';
$path = createPathString($d, $f);
?>
Would result in 'foo\bar' (Windows), 'foo/bar' (*n*x).
And
<?php
$d = 'foo/'; // note the trailing slash
$f = 'bar';
$path = createPathString($d, $f);
?>
on *n*x would also result in 'foo/bar' (i.e. the path would only contain
one "/").
--- End Message ---
--- Begin Message ---
Hi all,
After my escapades with the real basics and realizing my laptop wasn't
logged on as Administrator, I now am trying to work out why this script
works sometimes but not others.
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<?php
echo "<p>This is a PHP line</p>";
phpinfo();
?>
</body>
</html>
If I save this as phptest.php and open IE pointing it to
localhost/phptest.php it works fine. Get both lines of text followed by the
pages of gumpf about php.
However if I paste this into a
--- End Message ---