LegoMyGeggo Posted February 6, 2014 Share Posted February 6, 2014 Hi Larry & Everyone, I'm trying to follow your book and trying to set up the environment etc, but the huge problem I am running into is that my PHP code isn't executing when I load it into the browser and it just displays the source code. I have scoured around the web and haven't found any solutions to this. Any thoughts and possible help you guys could offer me? Apache seems to be running ok and I dont have any errors in my log (at least doesn't look like it)...what could be the problem? I installed xampp etc. Link to comment Share on other sites More sharing options...
HartleySan Posted February 7, 2014 Share Posted February 7, 2014 What folder are you executing the file from, what is the name of the file, and what URL are you using in the browser to access the file? Link to comment Share on other sites More sharing options...
LegoMyGeggo Posted February 7, 2014 Author Share Posted February 7, 2014 What folder are you executing the file from, what is the name of the file, and what URL are you using in the browser to access the file? Hey Hartley, I'm executing from C:\xampp\htdocs\phptest and just phpinfo.php using <?php phpinfo(); ?>. I am accessing it using the web browser: http://localhost/phptest/phpinfo.php when I use the web browser, it shows just the source code: <?php phpinfo(); ?> I tried changing the file to just be in htdocs and the same result. So I have no idea what I am doing wrong . Also when I access localhost, xampp says that mysql, php etc are active. Link to comment Share on other sites More sharing options...
HartleySan Posted February 7, 2014 Share Posted February 7, 2014 Are you sure that phpinfo.php is in fact a .php file, and not a .html or .txt file? Link to comment Share on other sites More sharing options...
LegoMyGeggo Posted February 7, 2014 Author Share Posted February 7, 2014 Yea, it's a php file. I went to the php_error_log and got this, not sure if this is what's causing the problem: [06-Feb-2014 22:16:30 Europe/Berlin] PHP Warning: file_get_contents(lang.tmp): failed to open stream: No such file or directory in C:\xampp\htdocs\xampp\index.php on line 2 Link to comment Share on other sites More sharing options...
HartleySan Posted February 7, 2014 Share Posted February 7, 2014 That shouldn't matter if you're going to http://localhost/phptest/phpinfo.php in the browser. Are you sure that your file doesn't have .txt appended onto the end of the file and your OS is just hiding that extension from you? Link to comment Share on other sites More sharing options...
LegoMyGeggo Posted February 7, 2014 Author Share Posted February 7, 2014 Yes 100% sure Link to comment Share on other sites More sharing options...
HartleySan Posted February 7, 2014 Share Posted February 7, 2014 Well, I've only ever seen what you're describing when you try to run an HTML or text file as a PHP file. I really can't offer any suggestions beyond that. Sorry. Link to comment Share on other sites More sharing options...
Larry Posted February 8, 2014 Share Posted February 8, 2014 The only possible explanation is your XAMPP isn't installed properly. Or isn't running properly. If you are going though http:// to access your files, there's no other answer. Link to comment Share on other sites More sharing options...
LegoMyGeggo Posted February 8, 2014 Author Share Posted February 8, 2014 The only possible explanation is your XAMPP isn't installed properly. Or isn't running properly. If you are going though http:// to access your files, there's no other answer. Hi Larry, Thanks for writing back to me. If I am able to access xampp through the localhost address etc and I get the main xampp page is there something missing? Link to comment Share on other sites More sharing options...
LegoMyGeggo Posted February 8, 2014 Author Share Posted February 8, 2014 Hey I fixed it some how...not sure but it works now HAHA. Thanks for everything Link to comment Share on other sites More sharing options...
HartleySan Posted February 8, 2014 Share Posted February 8, 2014 Well, if you ever figure it out, please let us know. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts