Trying to setup PHP on apache keep getting errors....
Moderator: General Moderators
Trying to setup PHP on apache keep getting errors....
Server Version: Apache/2.0.55 (Win32) DAV/2 mod_gzip/2.1.0 mod_ssl/2.0.47 OpenSSL/0.9.7b PHP/5.1.2
most scripts won't run ... get errors like this ... :
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache
Group\Apache2\htdocs\dk\lib.php on line 55
Notice: Undefined index: style in C:\Program Files\Apache Group\Apache2\htdocs\dice\dice.php
on line 3
Notice: Undefined index: dice in C:\Program Files\Apache Group\Apache2\htdocs\dice\dice.php
on line 4
Warning: getimagesize(styles/style/1.png) [function.getimagesize]: failed to open stream: No
such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\dice\dice.php on line
8
Fatal error: Call to undefined function ImageCreate() in C:\Program Files\Apache
Group\Apache2\htdocs\dice\dice.php on line 14
don't have ssl setup yet can't get apache to find a good server.crt...please help!!!
most scripts won't run ... get errors like this ... :
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache
Group\Apache2\htdocs\dk\lib.php on line 55
Notice: Undefined index: style in C:\Program Files\Apache Group\Apache2\htdocs\dice\dice.php
on line 3
Notice: Undefined index: dice in C:\Program Files\Apache Group\Apache2\htdocs\dice\dice.php
on line 4
Warning: getimagesize(styles/style/1.png) [function.getimagesize]: failed to open stream: No
such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\dice\dice.php on line
8
Fatal error: Call to undefined function ImageCreate() in C:\Program Files\Apache
Group\Apache2\htdocs\dice\dice.php on line 14
don't have ssl setup yet can't get apache to find a good server.crt...please help!!!
I don't understand what i need to do....
I'm a newbee at php...i've got perl down but i am just learning mysql and php... please explain in detail for me what to do...i can't figure it out any further...thanks
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
In my php.ini file the extensions are commented using semicolons ( ; ). You can usually uncomment the line of the extension that you want to use by removing the semicolon in front of it...
Code: Select all
;remove the semicolon from behind the following line
;extension=php_mysql.dll
; Or, for linux machines it might be a .so
;extension=mysql.so(assuming your OS is Win)
After doing what the guys here suggested you, make a phpinfo file and view it with your broswer and check for "Configuration File (php.ini) Path". If it set to something like 'C:\WINDOWS\' then that's not good and you'll need to put the php.ini file in your windows directory and then restart Apache. After that, go to the phpinfo file again and you should see 'C:\WINDOWS\php.ini'. Now all you've got to do is to put the file 'libmysql.dll' in your system directory - that would be 'system32' if you run Win xp or 'system' if you run Win 98.
After doing what the guys here suggested you, make a phpinfo file and view it with your broswer and check for "Configuration File (php.ini) Path". If it set to something like 'C:\WINDOWS\' then that's not good and you'll need to put the php.ini file in your windows directory and then restart Apache. After that, go to the phpinfo file again and you should see 'C:\WINDOWS\php.ini'. Now all you've got to do is to put the file 'libmysql.dll' in your system directory - that would be 'system32' if you run Win xp or 'system' if you run Win 98.
still have one error left....
i did all you guys said to do and i still have one more error with mysql....:
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\chess\createtables.php on line 7
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\chess\createtables.php on line 7
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Anyway, to OP, do have the php_mysql.dll file in your c:\PHP\ext\ folder? Make sure that is there, make sure the line that loads the module is uncommented (and make sure you are uncommenting the mysql line, not the mysqli line), restart apache then run your test script.
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Another thing you should do, too, is check which extensions are loaded in your PHP install. This might shed a little more light on the situation. Try running a print_r(get_loaded_extensions)) and see what tells you.
This is what i got...
Array ( [0] => bcmath [1] => calendar [2] => com_dotnet [3] => ctype [4] => date [5] => ftp [6] => iconv [7] => odbc [8] => pcre [9] => Reflection [10] => session [11] => libxml [12] => standard [13] => tokenizer [14] => zlib [15] => SimpleXML [16] => dom [17] => SPL [18] => wddx [19] => xml [20] => xmlreader [21] => xmlwriter [22] => apache2handler )
looks like its not loading mysql...why?
looks like its not loading mysql...why?
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
I found this function for loading extensions at runtime in the PHP manual.
Maybe try this for the 'mysql' extension. Also, did you make sure that you have the php_mysql.dll in your C:\php\ext folder?
Code: Select all
<?php
// Example loading an extension based on OS
if (!extension_loaded('sqlite')) {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
dl('php_sqlite.dll');
} else {
dl('sqlite.so');
}
}
// Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0
if (!extension_loaded('sqlite')) {
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX);
}
?>ok...something is wrong with php.ini
it's not loading any of the ext i select...i think it is useing another php.ini than the one i'm editing...maybe something in the apache conf...idon't know...please help...