Forum Moderators: coopster

Message Too Old, No Replies

phpMyAdmin Help! error 1.20

         

Raistlfiren

6:10 am on Aug 27, 2005 (gmt 0)

10+ Year Member



Hey,
I was setting up a webserver with Apache 2.0.54, MySQL Client Version 5.0.4, PHP 5, and of course phpMyAdmin 2.6.3... Anyway after spending hours setting up my PHP with Apache I go to install phpMyAdmin onto my server. Though as you can see it didnt go well...

Before I get started on my problem, thought I might tell you some info about the os and other helpful information. I currently have Windows XP Professional SP2 on it. I have also tested my webserver by typing 127.0.0.1 in my url bar and was able to succesfully get into my server. I am also able to access PHP, by typing 127.0.0.1/phpinfo.php.

Whenever I try to connect to 127.0.0.1/phpMyAdmin/index.php it does not work! Whenever I go to the website I first recieve this message :

cannot load mysql extension;
please check PHP configuration
Documentation

Of course "Documentation is leading off to another site on my server that gives a FAQ of information about the problem. This is what it says :

[1.20] I receive the error "cannot load MySQL extension, please check PHP Configuration".
To connect to a MySQL server, PHP needs a set of MySQL functions called "MySQL extension". This extension may be part of the PHP distribution (compiled-in), otherwise it needs to be loaded dynamically. Its name is probably mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension but failed.

Usually, the problem is solved by installing a software package called "PHP-MySQL" or something similar.


After checking multiple sites on the web, I have encountered not a whole lot as you can see me coming here... People have either went to a lower php or did unethical things by moving files to System32 and configuring things in your Enviroment Variables. I am trying to not have to have to go to a lower php. I was wondering if any of you knew what I mjay be doing wrong. I might also want to add that I really don't have much experience in making a server, and I'm just doing it to get the experince of doing it! Oh yes, I would also like to add that these are the running php modules after typing php -m in cmd prompt:

[PHP Modules]

bcmath
calendr
com_dotnet
ctype
dom
ftp
iconv
libxml
odbc
pcre
session
SimpleXML
SPL
SQLite
standard
tokenizer
wddx
xml
zlib

[Zend Modules]


Please help me, because I have totally run out of patience and I really do not want to screw up my settings with php 5! After spending hours configuring that... I also think that php comes out with more security each update... I am not totally sure about that...


I have tried to do the following also,

1. Get ZIPPED version of PHP for windows from [php.net...]
2. Extract the contents.
3. Find php_mysql.dll in EXT folder.
4. Copy and paste it in C:WINNT/SYSTEM32
5. Modify php.ini in C:WINNT as below.

extension_dir = "C:\WINNT\SYSTEM32"
extension=php_mysql.dll

The only thing I really had changed were my my enviromental variables. These are now my paths:

C:\Server\PHP
C:\Server\PHP\ext

I have alse set a varuable for PHPRC to where I set the path to PHP again :

C:\Server\PHP

I really don't know what else to say... I will add the few changes I did to my php.ini file and to my apache file. I also want to add that I have not touched MySQL at all and have not configured anything for that!

First thing I have changed in my PHP.ini script is the following :

extension_dir = "C:\Server\PHP\ext"
extension=php_mysql.dll (Took out the semi-colon next to it)

Loadmodule...

Apache Config Script :

ScriptAlias /cgi-bin/ "C:/Server/Apache2/cgi-bin/"
ScriptAlias /php/ "c:/Server/php/"

AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml

Action application/x-httpd-php Server/php/php.exe

Like I said before I have not configured my MySQL script. Please ask if you need anymore information. I just want to get this problem solved.

One other thing I would like to add is that I have been able to get phpMyAdmin with XAMP. Though, I can not get it working seperately! It is so irritating!
Thanks for any help,
Rat

[edited by: jatar_k at 2:29 pm (utc) on Aug. 27, 2005]
[edit reason] removed url [/edit]

coopster

8:29 pm on Aug 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, Raistlfiren.

There are a couple of threads in our PHP Library [webmasterworld.com] that might be handy:

Troubleshooting Steps for PHP/Apache on windows [webmasterworld.com]
Installing PHP5 Under Windows XP and Apache [webmasterworld.com]

Raistlfiren

6:26 am on Sep 3, 2005 (gmt 0)

10+ Year Member



Thanks for your reply, and my late responding to it... I have read all of the information you have given me, but I have a few troubles with instructions. The first problem I see is this:

Configuration File (php.ini)= Path C:\WINDOWS

It was C:\WINDOWS\php.in, but I deleted the file and now I get C:\WINDOWS... How do I get rid of this, I don't believee I am following the instructions correctly followed on the other webpages... I did put ./in the blanks next to extension dir in my php folder in C:\Server...

Grrr.... Could this be my problem? I didn't set something up correctly.I was also wondering where you put the .dll files at? Do you put those in WINDOWS, system32, or WINDOWS/System? I am so confused...

Rat

coopster

7:59 pm on Sep 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



On a Windows setup it is easiest to leave the php.ini file in the same directory as the php binaries (the "php" directory you extracted everything into when you installed). Then, in your Apache httpd.conf file use the Apache directive PHPIniDir ...
# configure the path to php.ini 
PHPIniDir "C:/php"

... to tell Apache where to find it. As far as installing extensions, I follow the same procedure, this time updating the php.ini directive ...
; Directory in which the loadable extensions (modules) reside. 
extension_dir = "c:\php\"

... rather than copy them to the Windows system folders. You could also use the c:\php\ext\ directory there, which is where they are all located by default from the binary installation.

Raistlfiren

9:07 pm on Sep 6, 2005 (gmt 0)

10+ Year Member



Hey,

I did as you said and added the PHPini Dir to my Apache httpd.confg file and it still wants to give me the error message! I also changed the extension directory to C:\Server\PHP\ext\ and it still does not work. I have a php.ini configuration file in about three directories! I don't know what else to do... Grrr....

I don't know what is wrong! The Apache webserver is running great, and phpinfo.php is displaying on my monitor, but phpmyadmin is not working. I believe I can also access mysql to, but don't know how to unless through cmd prompt... This is racking my brain and is taking forever! Any other advice or information... Here is the APache confg file changes (PHP,Apache, and MySQL are located in C:\Server):

LoadModule php5_module "c:/Server/PHP/php5apache2.dll"

AddType application/x-httpd-php .php

ScriptAlias /php/ "c:/Server/php/"

AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml

Action application/x-httpd-php Server/php/php.exe

# configure the path to php.ini
PHPIniDir "C:/php"

Now php file changes :

Uncommented:
extension=php_mysql.dll

extension_dir = "c:\php\"
; created my own directory so I can
; manage cleanup of temporary session files:
session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp"

grandpa

9:16 pm on Sep 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Did you stop and restart Apache after making the changes? Alternatively, you can reboot. I created a couple of batch files for the desktop to start and stop Apache on demand.

Raistlfiren

1:09 am on Sep 7, 2005 (gmt 0)

10+ Year Member



Yes, I did do that Grandpa... It still did not work... Just drives me out of my mind, I dont know what is wrong...

coopster

2:06 pm on Sep 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm guessing you are still missing another dll in your path and it is probably
libmysql.dll
. Have you reveiwed the MySQL Functions Installation on Windows Systems [php.net] yet?

BlarneyMan

5:47 pm on Sep 7, 2005 (gmt 0)

10+ Year Member



I'm also in phpMyAdmin hell.

My setup is: Windows XP Pro machine w/
Apache 2.0.54, PHP 5.0.4, mySQL 4.1.14 and phpMyAdmin 2.6.4 rc1

PHP seems to be working fine. I have a web-calender program that uses it and a BBS and both have no problems what-so-ever. mySQL also seems to be just dandy, because the Calender and BBS are drawing from it.

phpMyAdmin though, is not dandy. Every time I try to open the index file, I get a "can't find or read config" error, with a link below to the config file.

The only thing I even touched in the config file was the server address. When I click on the file, I get NO error message, nothing, a blank page.

I've got the directory permissions set to everyone has access. I just simply can't get the stupid thing to read the config file that's right under it's nose. Any ideas? Suggesstions?

Raistlfiren

3:55 am on Sep 8, 2005 (gmt 0)

10+ Year Member



Hey Coopster,
I did as you told me and checked that out. I copied the lob_mysql file into my WINDOWS folder and have of course the same enviromental variables :
C:\Server\PHP
C:\Server\PHP\ext
and variable = PHPRC, path C:\Server\PHP

I am still getting no response... I also tryed inserting this script and end executing it to see if mysql works... This is what I inserted into the php script:

<?php
// Connecting, selecting database
$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');

// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());

// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
mysql_free_result($result);

// Closing connection
mysql_close($link);
?>

I get the following error when executing it :

Fatal error: Call to undefined function mysql_connect() in C:\Server\Apache2\htdocs\execute.php on line 3

Rat

coopster

2:57 pm on Sep 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It certainly sounds like a php.ini issue then. First, search your system for any and all occurrences of php.ini and get rid of all of them (or rename them or something) so you have one, and only one, php.ini. It should be the one that resides in your path according to the Apache directive you just set:
PHPIniDir "C:/php"

Restart Apache.
Run a simple script
<?php 
phpinfo();
?>

and see what extensions are loaded. Do you see MySQL listed? How about the other directive you modified in your Apache config ...
; created my own directory so I can 
; manage cleanup of temporary session files:
session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp"

Does this session.save_path directive show the directory you instructed in the php.ini?

coopster

2:59 pm on Sep 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



BlarneyMan, welcome to WebmasterWorld.

You will probably want to start a different thread -- or do a quick search over this forum (and/or the phpMyAdmin forums) to see what type of troubleshooting you can do for your phpMyAdmin configuration.

Raistlfiren

8:42 pm on Sep 8, 2005 (gmt 0)

10+ Year Member



Okay this is what I did :
First I searched my computer and found the php.ini files in three different locations... One was in C:\Server\PHP DIR, another in my C:\Server\Apache2\htdocs DIR, and another was in my WINDOWS DIR. I deleted both the one in the apche2 dir and the windows dir.

After I did that I restarted the server and looked at my phpinfo.php on my server and found that I could only see sql lite in my phpinfo.php file. I also saw that the Configuration File (php.ini) Path was C:\WINDOWS still... Another thing was when I went to the sessions.savepath I found that no temp folder was created in there at all and there was no folder called temp. The temp information was supposed to go into the php.ini file right?

Another thing I noticed in my php folder was that there were too php files... php.ini.dst and php.ini.recommended(bigger file than php.ini.dst/the file I have now enabled) I will try opening up that file to see if that isn't the problem...

Rat

coopster

8:57 pm on Sep 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member




First I searched my computer and found the php.ini files in three different locations... One was in C:\Server\PHP DIR, another in my C:\Server\Apache2\htdocs DIR, and another was in my WINDOWS DIR. I deleted both the one in the apche2 dir and the windows dir.

That's all good, but now notice what directory your PHPIniDir directive is set to in your Apache config? It is 'c:\php' -- I'm guessing it should be 'c:/Server/php' -- no? The directive in Apache tells it where to find your php.ini file and it isn't going to find it because there is no 'c:/php' directory on your machine. Therefore, as stated in one of the troubleshooting threads earlier, PHP will use it's own *internal* php.ini. That's why the phpinfo() showed you this ...


After I did that I restarted the server and looked at my phpinfo.php on my server and found [...] that the Configuration File (php.ini) Path was C:\WINDOWS still...

It is also why your session.save_path is not reflecting the value you specified. By the way, if I remember correctly, PHP won't create the temp directory for you, you are merely telling PHP where to write the session save file information as it creates and manages sessions. You will probably have to create the directory manually.

Yes, PHP does come with two different options for php.ini initial configuration setups. You can open both and read through them to see which you would rather begin using and make a copy of it to your root PHP directory (which it seems you have already done).

Anyway, get that PHPIniDir directive pointing to your php.ini file's directory ('c:/Server/PHP') and restart Apache. You should then see your extensions and session.save_path directives showing what you expect.

Raistlfiren

11:02 pm on Sep 8, 2005 (gmt 0)

10+ Year Member



Oh my gosh! I bow down to you. :) Just kidding... Just kidding... lol I have it all setup and now phpMyAdmin works! w00t! Thank you so much!

I was wondering though if you knew of any security precautions I can take to secure my webpage/host... I was also wondering if there is a way from to not allow people to access my phpmyadmin file off my site... Do you know how to do this? One more thing is, do you know anything about these two red text prhrases:

The $cfg['PmaAbsoluteUri'] directive MUST be set in your configuration file!
The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results.

Thank you so much!
Rat

coopster

11:16 pm on Sep 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



There are plenty of security precautions. Physical security, operating system lockdown, permissions, Apache security [httpd.apache.org], PHP Security [google.com] ... lots to learn.

I can't help you much with PHPMyAdmin, I've never used it. You might try their site forums to see if you can find any discussion or FAQ on securing their software. Perhaps somebody else in this forum has some ideas ...?