Page 1 of 1

Database Problems, Windows 7 and php.ini

PostPosted: 10. November 2010 14:47
by hwalker1
I have installed Xampp and everything works as it should when I create and run a .php file. Except when that file contains any reference to a databse connection. When that happens, instead of generating the page, only the code appears in the browser. I am using version 1.7.3 on a 64 bit Windows 7 platform. My connection file successfully connects with the database when run in Dreamweaver, but when I try to preview a file in my browser, all I get is the code.
The code was originally written for PHP 4, and runs without any problem on my other installation, which dos not use xamp,with the components installed as seperate units. I was told that PHP 5 should be backwards compatible with most PHP4 code.

In addition, Windows 7 does not seem to display the file endings of .ini files, so it is hard to know which file is php.ini. A search for php.ini does not come up with a file of that name, but with a whole host of files called just php.

Does the standard install of xamp have an ini file that allows PHP and MySql to work together, or does it need changes.

Re: Database Problems, Windows 7 and php.ini

PostPosted: 10. November 2010 16:43
by peterwt
I am using XAMPP latest version on Windows 7 64 bit without any problems, including database access.

To be able to see the file extensions in Explorer- in Explorer view - Tools/Folder Options - in View tab uncheck "Hide extensions for known file types".

Peter

Re: Database Problems, Windows 7 and php.ini

PostPosted: 10. November 2010 17:31
by WilliL
it could be short_open_tag (standard OFF in PHP 5.3)
try instead of "<?" the "<?php" and instéad of "<?=" new "<?php echo"

you can also try to switch short_open_tag ON. http://community.apachefriends.org/f/viewtopic.php?f=16&t=42437&p=167272&hilit=short_open_tag#p167272

Re: Database Problems, Windows 7 and php.ini

PostPosted: 11. November 2010 23:49
by hwalker1
peterwt wrote:I am using XAMPP latest version on Windows 7 64 bit without any problems, including database access.

To be able to see the file extensions in Explorer- in Explorer view - Tools/Folder Options - in View tab uncheck "Hide extensions for known file types".

Peter


Thanks for that Peter. I also found out why the database would not work. It is a combination of causes as usual, one to do with a missing view, on which I have posted again today, and the other to do with the fact that the database dump came from a server where all files had to have the .php5 extension in order to run. There is somewhere in PHP a way to allow unusual filename ends, but its a long time since I did it and I have not found it again, so I just renamed all the files ending in .php5 to end in .php and at least the files without database code related to a missing view now display and run. I'm not sure if this php / php5 thing is Xampp related or a Dreamweaver problem.