Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

Cannot get MySQL to work with PHP and SMF

Aloittaja ed_huang, huhtikuu 19, 2006, 07:56:24 IP

« edellinen - seuraava »

ed_huang

SMF Version: SMF 1.0.7
Here's my stats:
O/S Windows 2000 PRO
updated with latest service packs

1) SMF1.7
C:\Program Files\Apache Group\Apache2\htdocs\smf_1.7

2) php-5.1.2-Win32
C:\php

3) mysql-5.0.20-win32
C:\mysql

4) apache_2.0.55-win32-x86-no_ssl.msi
C:\Program Files\Apache Group\Apache2

apach was the only NON manually installed server, the rest was manually installed by me and I DID edit the config files for SO many times.

[my.ini] is inside C:\mysql
[php.ini] is inside C:\php
[httpd.conf] is inside C:\Program Files\Apache Group\Apache2\conf

i also changed the PATH and CLASSPATH to ALL include these directories,
like this:

C:\php\;C:\mysql\bin;C:\mysql

but i didn't include the directory for the Apach things, i mention this in case its relevant.

Major Issue
MySQL having communication errors with PHP, they just won't communicate, before when i first installed all these i was a noob and it worked, now im turning into a beginner by researching why the heckl its not working anymore >< !

This is the standard smf install error since it just doesn't detect MySQL:

"The installer was unable to detect MySQL support in PHP. Please ask your host to ensure that PHP was compiled with MySQL, or that the proper extension is being loaded."

It suddenly jsut stopped working, i dunno why maybe i did somthing and didn't know about it but i tried for weeks tryin to fix it. I tried evertytin i can find.
There must be a simple error thats blocking the communication i jus can't find it. My Server runs fine, my php runs fine i tested it using the phpinfo.php file. I can loggin and connect inside to mySQL jus fine - but when i use telnet localhost 3306 it can connect but for a few seconds then disconnects i do not know if that is normal or not but i just want to mention maybe it matters.

Also when using Macromedia Dreamweaver i also cannot connect to mysql server to select a database to work on, this further says there is a communiucation problem. I do NOT have any firewalls like norton installed.

Here is a list of my config files - i put only wht i CHANGED and other relevant things that i included but didn't change at all:

PHP.INI

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
doc_root = "c:\Program Files\Apache Group\Apache2\htdocs\smf_1.7"

; The directory under which PHP opens the script using /~username used only
; if nonempty.
user_dir =

; Directory in which the loadable extensions (modules) reside.
; i put all extentions in the /php directory
extension_dir = "c:/php/"

; Windows Extensions
; I removed the semi colon to activate this module
; I KEPT THE REST AS THER WERE
extension=php_mysql.dll

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
mysql.max_links = -1

mysql.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket =

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host = localhost

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user = tsepin

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password = pin8462555

; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off

httpd.conf

ServerRoot "C:/Program Files/Apache Group/Apache2"
Listen 80

PHPIniDir "c:/php"
LoadModule php5_module "c:/php/php5apache2.dll"

ServerAdmin [email protected]
ServerName hxxp:redground.no-ip.org [nonactive]:80

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/Program Files/Apache Group/Apache2/htdocs">

AddType application/x-httpd-php .php


my.ini

# The following options will be passed to all MySQL clients
[client]
#password   = your_password
port      = 3306
socket      = /tmp/mysql.sock

# The MySQL server
[mysqld]
port      = 3306
socket      = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir=c:/mysql
datadir=c:/mysql/data

stops here

Note: Anything that i did not post here means i did NOT change it, do not understand it and don't think its relevant.

i have thought about reformatting my entire pc or buy a new HD and try everything there because i DID get it to work in the past when i first installed php mysql and apache all at the same time. And at the time i am worse a noob, so there must be either a very simple error that causing trouble or it may be my o/s problem... but thats only my best guess.... and i dunno what better to do......./cry

Oldiesmann

Go to Start -> run and type "cmd" in the box. When the command prompt window comes up, enter the following command:

NET START MySQL

If there's a problem with MySQL, that should give you an error message of some sort. Also, make sure you re-start Apache after you make any changes to php.ini or they won't take effect.
Michael Eshom
Christian Metal Fans

ed_huang

Ok,

just like 2 minutes AFTER i made my initial post.... i suprisingly SOLVED the damn problem.....

When i restart my Apache i use the RESTART command everytime, this time i pressed wrongly and pressed STOP then i pressed START.. of course.

But this time it finaly bounced its main problem... it can't find the following file:

libmySQL.dll


this file is originally in the mysql directories, it is located in several directories in the AND in the PHP directories so what i did was i copied it and then put in the directory that Apached was trying to find all this time (but didn't tell me until NOW)

and therefore it works fine for now, so far. and Macromedia access to the mySQL works fine too. Finally i can begin some forum action and some web designing....

i hope this helps anyone with the SAME problem.

Oldiesmann

#3
For future reference, that file should be in your "System32" directory (under C:/WinNT in NT and 2000, under C:/WINDOWS in XP) or another directory that's in your PATH variable so that Windows will be able to find it. Glad you got it solved.
Michael Eshom
Christian Metal Fans

Advertisement: