nicholasjamesevans Posted September 10, 2015 Share Posted September 10, 2015 (edited) Hello everyone,My name is Nicholas, but please feel free to call me Nic. I just bought Larry's "PHP for the Web" book and it has been a great intoduction so far. I've gotten to the part in which Larry talks about getting a phpinfo.php file running. Unfortunately, it covers Windows and OS X, but not linux/Ubuntu.I am currently running Ubuntu 14.04.2 LTS 64-bit. I am also using Gnome Shell Version 3.12.2 (if that is at all relevant, it wouldn't hurt to know at least)I have Apache2 installed on my system (2.4.7) and I do not know how to get phpinfo.php running on it.I'd be happy to add any additional details upon request, and I thank you for your time in regards to this question.Best,Nic UPDATE: Alright, so I've figured it out! The magic of research. I can access "localhost/phpinfo.php" in my web browser. However, phpinfo.php is just a blank white page. This isn't how the page is supposed to appear is it? UPDATE 2:After further reading, and file editing, I realized that I had not added a ";" to the code for phpinfo.php. What a simple mistake that could cause a lot of frustration. Unfortunately, that did not fix the problem. (1) I know my path is an actual URL starting with http:// (2) I know I have PHP enabled on the server. (3) I am not exactly sure what is meant in the book by "using the proper extension" I have a test.php file that I can open with my localhost. All the code is, is as follows: <?php phpinfo(); ?> So that file is working properly. (I believe I made it a while back when I first started getting into PHP, but didn't pursue it and soon gave up.) Why would the older test.php file work and not the phpinfo.php? Edited September 11, 2015 by nicholasjamesevans Link to comment Share on other sites More sharing options...
Larry Posted September 11, 2015 Share Posted September 11, 2015 Hey Nic! Digital Ocean has some great docs specific to Ubuntu, including how to install PHP. I'd start there: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu Link to comment Share on other sites More sharing options...
nicholasjamesevans Posted September 11, 2015 Author Share Posted September 11, 2015 Thank you Larry! I have the PHP working now, so the server and PHP is good, but the specific file isn't working. Is there possibly anything wrong with my code? It is as follows:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>First PHP Script</title> </head> <body> <?php phpinfo(); ?> </body></html> Link to comment Share on other sites More sharing options...
Larry Posted September 12, 2015 Share Posted September 12, 2015 There's nothing wrong with your code. Could you elaborate on -how- it's not working? What happens that shouldn't? What should happen but doesn't? Are you seeing error messages? If so, what are they? What URL are you using to run this? Link to comment Share on other sites More sharing options...
nicholasjamesevans Posted September 12, 2015 Author Share Posted September 12, 2015 There's nothing wrong with your code. Could you elaborate on -how- it's not working? What happens that shouldn't? What should happen but doesn't? Are you seeing error messages? If so, what are they? What URL are you using to run this? Yes, so the code is good. The page in my browser loads as a white blank page. There are no error messages, and I am using http://localhostin Firefox. The other php file is test.php and it has this code: <?php phpinfo(); ?> That file works fine! Which is quite odd. If my code is good on the other file, and my server is working with PHP, why am I seeing a blank white page? Link to comment Share on other sites More sharing options...
nicholasjamesevans Posted September 12, 2015 Author Share Posted September 12, 2015 Okay, so the strangest thing was going on. That specific file would not work! The code wasn't the problem, the PHP is running fine as well as Apache2.I deleted phpinfo.php and made a new file with the same exact name, phpinfo.php, and copied the same exact code to it. It worked great. I am happy it works now! But why in the world would that happen? Link to comment Share on other sites More sharing options...
Larry Posted September 14, 2015 Share Posted September 14, 2015 Um...I could really say as to why that would happen without knowing how, exactly, it wasn't working before. But! I'm glad it's working for you now. Link to comment Share on other sites More sharing options...
Recommended Posts