Max Posted November 1, 2011 Share Posted November 1, 2011 Hi Larry I have been using your book for some time now (I was a poster about 3 years ago on this forum) and have to say that it still amazes me what a comprehensive and well written publication it is. I wish you would write a javascript tome in the same manner. The question is that I have installed php and MySQL onto the D: drive of my XP Home laptop using XAMPP from www.apachefriends.org and it now appears to run well according to the XAMPP Control Panel showing Apache and MySQL "Running" but when I run a php program using Firefox it appears that php is not actually running. The browser displays the html part of the php program and looking at the Firefox source code, one can see the php code. This software works perfectly on the 1and1 server. Am I missing something? Link to comment Share on other sites More sharing options...
Paul Swanson Posted November 1, 2011 Share Posted November 1, 2011 Are you accessing the page using an URL? If you just open the file, or launch it by clicking on it, it won't be run through the server. You must access it by entering '//localhost/path/to/your/file' in order for it to work properly. 1 Link to comment Share on other sites More sharing options...
Larry Posted November 2, 2011 Share Posted November 2, 2011 Thanks for the nice words, Max. Just so you know, I'm writing a JavaScript book right now! Link to comment Share on other sites More sharing options...
Max Posted November 3, 2011 Author Share Posted November 3, 2011 Hi Paul Thanks for your input. The website home page is www.sonningmowers.com/html which then loads the various .php pages (e.g. about us) and which works fine on 1and1 server. When I run it on the laptop and call other pages, they don't hook into php. XAMPP is running with php and mysql with svc ticked and 'Running' showing for both. phpinfo() gives me PHP version 5.3.8. I have tried your suggestion but no dice. Both the code and php are running out of the D: drive (partition). Hmmm. Baffling. Link to comment Share on other sites More sharing options...
Paul Swanson Posted November 3, 2011 Share Posted November 3, 2011 Hi Max, Open httpd.conf in \XAMPP\apache\conf and look at both ServerRoot (defaults to C:/xampp/apache) and DocumentRoot (defaults to C:/xampp/htdocs) and make sure they point to the correct locations. You might only have to change the drive letter. Then restart Apache and see if that fixes it. 1 Link to comment Share on other sites More sharing options...
Max Posted November 4, 2011 Author Share Posted November 4, 2011 Hi Paul Tried your suggestion but locations were correct (XAMPP was in the D: drive). Uninstalled and re-installed XAMPP to the D: root but to no avail. Shows 'running' in control panel but when I call a .php file it doesn't run (except the HTML!). Still baffled! Link to comment Share on other sites More sharing options...
Larry Posted November 4, 2011 Share Posted November 4, 2011 Could you confirm the URL you're using to run this on your local computer? Link to comment Share on other sites More sharing options...
Max Posted November 5, 2011 Author Share Posted November 5, 2011 Hi Larry This is the URL of a very simple test program that I wrote to simplify matters: file:///D:/xampp/htdocs/phptest.php Code: <?php $x = 5; $y = 6; $z = $x * $y; echo $x . $y . $z; ?> In www.sonningmowers.com/phptest.php it gives the expected 5630. On the laptop I just get a blank screen (Firefox) and a source code which is the php script. Apache, MySQL and Filezilla are all ticked and 'RUNNING' according to XAMPP Control Panel. http://localhost/xampp/ shows: MySQL database ACTIVATED PHP ACTIVATED HTTPS (SSL) ACTIVATED Common Gateway Interface (CGI) ACTIVATED Server Side Includes (SSI) ACTIVATED SMTP Service DEACTIVATED FTP Service ACTIVATED Tomcat Service DEACTIVATED HTTP Headers:... HTTP Request GET /xampp/phpinfo.php HTTP/1.1 Host localhost User-Agent Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language es-es,es;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding gzip, deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 DNT 1 Connection keep-alive Referer http://localhost/xampp/navi.php PHP:... PHP Version 5.3.8 I can't help feeling that I'm missing something simple and that (as with many times in the past) I will find the answer in your book, but it escapes me at the moment. As said before, I have had PHP MySQL running on the same laptop in the past but probably on the C: partition. Unfortunately, C: seems to be being hogged by Windows updates etc.so have to use D: As always, help very much appreciated. Link to comment Share on other sites More sharing options...
Jonathon Posted November 5, 2011 Share Posted November 5, 2011 You need to run it through http:// I believe You can't run PHP through a file as far as i'm aware as it doesn't invoke the php parser. The url should be (i think, not 100% sure on your set up here, as I only glanced at it) http://localhost/phptest.php Link to comment Share on other sites More sharing options...
Max Posted November 6, 2011 Author Share Posted November 6, 2011 Jonathon Many thanks - you've solved it! AND YES! it's in Larry's book on page 599. If at first you don't succeed, read the book!...again. Link to comment Share on other sites More sharing options...
Jonathon Posted November 6, 2011 Share Posted November 6, 2011 No problem, I think Paul actually called it early doors. But glad it's working for you. 1 Link to comment Share on other sites More sharing options...
Recommended Posts