Re: PHP 5 Configuration
| From: | php at karsites dot net | Date: | Sat, 04 Feb 2006 09:16:30 +0000 |
| Subject: | Re: PHP 5 Configuration | ||
| References: | 1 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-16977@lists.php.net to get a copy of this message | ||
Hi Roger. I'm using php/mysql/apache under Linux, but most
of this should also apply to Windows as well.
It sounds like mysql server is up and running, as you are
connecting to it OK, using the mysql client.
Try using the phpinfo() function. This will return ALOT of
usefull system information to aid debugging an installation.
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>
register_globals is off by default in php.ini for security
reasons.
See http://uk.php.net/manual/en/security.globals.php
You need to make sure you are specifying the correct path to
the extension dir, where the php_mysql.dll is located.
In the configuration below, you have two different values
for this directive. It looks like the new php.ini
configuration file has changed the value of the
extension_dir= directive,
from extension_dir = "C:\php\ext"
to extension_dir = C:\php5
Change that back to what it was originally, and that should
solve that problem.
You also have to tell php what socket or port to talk to
mysql on.
Check out the following in php.ini
; Default port number for mysql_connect(). If unset,
; mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in
; /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).
; Win32 will only look at MYSQL_PORT.
mysql.default_port =
you could try
$ my_print_defaults mysqld
to give you the value of the port mysqld server is listening
on for connections. PHP needs to communicate with mysql on
the same port, 3306 default on Linux.
There may be other issues as well.
HTH
Keith
In theory, theory and practice are the same;
In practice they are not.
On Fri, 3 Feb 2006, Roger Dickinson wrote:
> To: php-install@lists.php.net
> From: Roger Dickinson <MartianRover@clearwire.net>
> Subject: [PHP-INSTALL] PHP 5 Configuration
>
> Howdy,
>
> I have Windows 2000 Professional installed on my computer with IIS.
> I installed MySQL and it seems to be working properly though the
> MySQL command line client.
> I installed PHP 5.1.2 and it seems to be working properly (at first
> glance).
>
>
> My problem. I copied the php.ini-recommended file to the php.ini
> file. They are located in the PHP directory (C:\PHP). I made a
> couple changes:
>
> include_path = ".;c:\php\includes;C:\php\pear"
> doc_root = "C:\Inetpub\wwwroot"
> extension_dir = "C:\php\ext"
>
> And I un-commented:
>
> extension=php_mysql.dll
>
> I also have C:\php in the system path variable.
>
> I have two problems. First when I use the echo
> $_SERVER['HTTP_USER_AGENT'] to show its information, I notice that
> the variables I set are not being set. They are there default (I
> assume) values.
>
> include_path = .;C:\php5\pear
> doc_root = no value
> extension_dir = C:\php5
>
> Both the local and master value are the same. I followed the
> installation instructions to the letter. Am I missing something?
> How do I solve this?
>
> My second problem, which I assume is because of the above problem.
>
> I get the following error:
>
> Fatal error: Call to undefined function mysql_connect() in
> c:\Inetpub\wwwroot\index.php on line 20
>
> When I run the following script:
>
> <html>
> <head>
> <title> --- </title>
> </head>
>
> <body>
>
> Welcome To<BR>
> <H1> --- </H1>
>
> <?php echo "Hello!"; ?><BR><BR>
> <?php echo $_SERVER['HTTP_USER_AGENT']; ?><BR><BR>
>
> <?php
> phpinfo();
>
> $link = mysql_connect ('localhost', 'root');
> if (!link)
> {
> die('Could not connect: '. mysql_error());
> }
>
> echo 'Connected successfully';
> mysql_close($link);
> echo 'Connection closed';
> ?>
>
> </body>
> </html>
>
> Any help is appreciated, as I am dead in the water with no paddles.
>
> ______________________________________________
> - Martian Rover KF6KNC