Page 1 of 1
[SOLVED] PHP 5 giving strange results and mysql not found
Posted: Tue Jun 15, 2004 12:05 pm
by anjanesh
Hello
I've finally decided to move to php5 (using IIS) because of its new features but now I'm having second thoughts.
I extracted all the php5 files to C:\PHP and did all the relevant configuring in IIS to php5 etc.
The first thing I tried out was phpinfo(); and it worked with no errors. BUT my MySQL settings does not exist. There is not a single "mysql" keyword in the phpinfo() page !!! All worked ok with php4.3.4. My MySQL ver is 4.0. This is strange because : I have a site already made in php4.3.4 and works OK. Now the html tags are showing but with the first line
PHP has encountered an Access Violation at 016E73DD
Then I did a test(index.php) in test folder the result was
HTTP 500 Internal Server Error
The location
http://localhost/test/index.php exists and works in php4.3.4. All it contains
This is strange because in one location theres all these html tags with php lines and displays the page except when trying to conect to the db (since mysql is not found) with the access violation error and then there is this other location which doesn't even load giving 500 internal server error.
I have NO IDEA what the problem is now.
If I can't find a solution to this I'll have to switch back to php4.
Please help
Thanks
Posted: Tue Jun 15, 2004 3:30 pm
by anjanesh
I've switched back to PHP 4.3.4 since I'm having no luck with PHP 5. But if there are any solution ideas then I'll gladly appreciate it.
Thanks
Posted: Tue Jun 15, 2004 3:35 pm
by redmonkey
By default mySQL support is not enabled by default with PHP5. You will need to uncomment the php_mysql.dll line within the extensions section of php.ini, you also need to make sure your extensions path is defined correctly.
Additionally, there should be a libmysql.dll file which you need to move/copy to your windows directory.
Posted: Tue Jun 15, 2004 4:07 pm
by anjanesh
Really ? I had a feeling this may be a problem but I didn't make any changes since its written in install.txt in the PHP5 installation folder that :
Note:
Since PHP 4.0.5 MySQL, ODBC, FTP, Calendar, BCMath, COM, PCRE,
Session, WDDX and XML support is built-in. You don't need to
load any additional extensions in order to use these functions.
Examples of PHP Extensions
php_dbase.dll dBase functions
php_filepro.dll Read-only access to Filepro databases
php_gd2.dll GD library functions for image manipulation
php_hyperwave.dll HyperWave functions
php_imap.dll IMAP functions
php_ldap.dll LDAP functions
php_mssql.dll MSSQL client (requires MSSQL DB-Libraries)
php_snmp.dll SNMP get and walk functions (NT only!)
php_zlib.dll ZLib compression functions
They mentioned MySQL but no dll file in the above list. (though mssql is there - typing mistake ? )
Posted: Tue Jun 15, 2004 4:10 pm
by feyd
uh... didn't they switch to MySQLi for 5?
Posted: Tue Jun 15, 2004 4:11 pm
by redmonkey
All the official install documentaion for PHP has yet to be updated for PHP5 (or at least that was the case the last I looked). This, I would assume is probably down to the fact that PHP5 is still in RC status.
There should be both a mssql and mysql dll file, you will also find a mysqli dll just to add to your confusion.
Posted: Tue Jun 15, 2004 4:24 pm
by anjanesh
Now I am getting this :
Warning
PHP Startup : Unalbe to load dynamic library 'C:\PHP5\ext\php_mysql.dll' -The specified module could not be found
I uncommented extension=php_mysql.dll
extension_dir = "C:\PHP5\ext"
Even phpinfo(); wont show up becuase of this startup warning. I set startup_errors/warnings etc to On
Posted: Tue Jun 15, 2004 4:32 pm
by markl999
Does C:\PHP5\ext\php_mysql.dll exist?
Posted: Tue Jun 15, 2004 4:37 pm
by anjanesh
Yes it does. Now I copied php_mysql.dll to C:\PHP5 instead where php5isapi.dll resides - says the installation manual
You need to ensure that the dlls which php uses can be found. The precise dlls involved depend on which web server you use and whether you want to run php as a cgi or as a server module. php5ts.dll is always used. If you are using a server module (e.g. isapi or apache) then you will need the relevent dll from the sapi folder. If you are using any php extension dlls then you will need those as well. To make sure that the dlls can be found, you can either copy them to the system directory (e.g. winnt/system32 or windows/system) or you can make sure that they live in the same directory as the main php executable or dll your web server will use (e.g. php.exe, php5apache.dll).
Now phpinfo() loads but again back to sqaure 1 - no mysql keyword in the entire page.
Posted: Tue Jun 15, 2004 5:02 pm
by redmonkey
Try.....
extension_dir = "C:/PHP5/ext/"
Note the trailing slash.
Also did you copy the libmysql.dll (I assume it is still there I was using PHP5RC1) to your windows folder (i.e. windows or winnt).
Posted: Wed Jun 16, 2004 12:11 pm
by anjanesh
[SOLVED]
Wow. Its now working. Thanx Redmonkey. I changed as you said (exceppt for forward slashes) C:\PHP5\ext\ and restarted IIS and now works. Man, I cannot believe there is this much difference b/w PHP4 & PHP5 because I am SURE that in php4 it was just C:\PHP4\extensions
[SOLVED]
Posted: Wed Jun 16, 2004 12:20 pm
by anjanesh
Oh. By the way. Sometimes you may get
PHP has encountered an Access Violation at 016E73DD
or some other address
PHP has encountered an Access Violation at xxxxxxxx
or even HTTP 500 Internal Server Error even though the file exists.
This seems to be a problem with php5isapi.dll. But you have a page that contains headers and html tags and all that it does not show up. Don't ask why - this is how its working on my system. If you have a file with <?php print("hello") ?> and it still does not work then try adding <HTML></HTML> and/or header() with all other basic stuff - it works. php.net has to fix the isapi.dll
Posted: Wed Jun 16, 2004 2:54 pm
by redmonkey
Given that you are talking about two versions of PHP with different major revision numbers I'm not surprised there are compatability problems.
Why should your config from PHP4 work with PHP5? Why should PHP5 work exactly the same as PHP4? If PHP5 was 100% backwards compatible with PHP4 then it would be a PHP4 revision not PHP5.
A change in major revision normally indicates that there will be compatability issues or some thing(s) have been implemented differently to the extent that it is not compatable with previous versions.
I admit that the current documentation bundled with PHP5 is not accurate and has not been updated for PHP5 but it is still in RC status, this is not an offical stable release. As a result PHP5 is not really intended to be used in your everyday production or development environment. It is released for those who a) want a sneak preview of the latest new features. b) want to test and possibly provide feedback and/or bug reports. In both cases, it does seem to be assumed that you have some knowledge of the development roadmap and changes between the major revisions.
With regard to your 'access violation' problem. Many of these problems seem to be attributed to PHP loading the wrong versions of dlls. You should check that all the PHP related dlls in your system directory are for your version of PHP5 and you don't have any PHP4 dlls in there.
When working with pre-release versions you should always try the latest snapshot (if available) before submitting a bug report.
For what it's worth, I've had no such problems when compiling on Linux.