fatal_banana Posted November 2, 2015 Share Posted November 2, 2015 I'm having a client side issue that's probably a server side issue. A test php file of phpinfo will properly display in browser when I navigate to that page. However, when I try to access any other php file, the page is completely blank. Here is one of the php files that won't display anything: <?php $mysqli = new mysqli("localhost", "user", "password", "database"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } echo $mysqli->host_info . "\n"; $mysqli = new mysqli("127.0.0.1", "user", "password", "database", 3306); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } echo $mysqli->host_info . "\n"; ?> its labeled test2.php and is in the application's root directory. I get a blank page in Firefox and Internal Server Error 500 from Internet Explorer (which is almost never used).I'm not entirely sure where to start with this and any other posts I've found about this were no help. Also, I'm pretty new to php and what not, so be gentle Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/ Share on other sites More sharing options...
mac_gyver Posted November 2, 2015 Share Posted November 2, 2015 do you have php's error_reporting set to E_ALL and display_errors set to ON in the php.ini on your development system so that php would help you by reporting and displaying all the errors that it detects? you will save a ton of time. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525229 Share on other sites More sharing options...
fatal_banana Posted November 2, 2015 Author Share Posted November 2, 2015 changed php.ini options to error_reporting = E_ALL; and display_errors = ON; is that the correct syntax for the file? Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525238 Share on other sites More sharing options...
mac_gyver Posted November 2, 2015 Share Posted November 2, 2015 there are no semi-colons ; and you will likely need to restart the web server to get any changes to take effect. the phpinfo() output should reflect the changes being made to the two settings. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525241 Share on other sites More sharing options...
fatal_banana Posted November 2, 2015 Author Share Posted November 2, 2015 Alrighty, thats done. I can't seem to find the logs this might be creating. Or are there no logs? Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525243 Share on other sites More sharing options...
mac_gyver Posted November 2, 2015 Share Posted November 2, 2015 if the php.ini that you are changing is the one that php is using, and you have confirmed that the settings took effect in the phpinfo() output, any php errors should be displayed in the browser when the .php page is output. in some cases, the php error messages are inside of html tags/form elements and are only visible in the 'view source' of the page in your browser. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525244 Share on other sites More sharing options...
fatal_banana Posted November 2, 2015 Author Share Posted November 2, 2015 Hmmm its not displaying errors; even in the page source. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525245 Share on other sites More sharing options...
mac_gyver Posted November 2, 2015 Share Posted November 2, 2015 if you put an echo 'start'; statement in your file before your $mysqli = new mysqli ... line code and echo 'end'; after your echo $mysqli->host_info . "\n"; line of code, do you get either or both of the start/end being output to the browser? Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525246 Share on other sites More sharing options...
fatal_banana Posted November 2, 2015 Author Share Posted November 2, 2015 Nope. Blank page and source is a blank html document with minimal tags: html, header, body. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525247 Share on other sites More sharing options...
fatal_banana Posted November 2, 2015 Author Share Posted November 2, 2015 This is from my phpinfo() page. I dont see anything disabled that seems suspect, but I'm very inexperienced. Debug Build no Thread Safety disabled Zend Signal Handling disabled Zend Memory Manager enabled Zend Multibyte Support disabled IPv6 Support enabled DTrace Support disabled Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525248 Share on other sites More sharing options...
mac_gyver Posted November 2, 2015 Share Posted November 2, 2015 source is a blank html document with minimal tags: html, header, body. that would indicate you have html markup in the file, not just the php code you are showing us. perhaps you should show or attach the complete .php file and exactly what the 'view source' of the output is. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525254 Share on other sites More sharing options...
fatal_banana Posted November 3, 2015 Author Share Posted November 3, 2015 Nope. No html markups in the file. It's file name is test2.php and all of the code that is in that file is exactly as aforementioned. It's saved in the normal spot /var/www/html. I'm using centos 7 if that makes a difference. exact source in browser is <html> <header> </header> <body> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525313 Share on other sites More sharing options...
mac_gyver Posted November 3, 2015 Share Posted November 3, 2015 about the only remaining thing that could be causing this symptom, is if there's a file naming (capitalization matters on a case-sensitive operating system) or permission problem and the web server cannot find or access your file, combined with something preventing a http 404 or related error from being output. check the web server access and error logs to see if there are any errors that correspond to you requesting the file in your browser. this also raises a question, what url did you use in your browser when you requested the page containing the php code with the phpinfo(); statement in it? it should have been something like http://localhost/yourfile.php if nothing else, start over with a new file, with just <?php echo 'something here'; ?> in it, save it to the document root folder, and enter the url, http://localhost/your_filename_here.php in the browser and see what you get. short-answer - this is not that difficult. if you have one .php file that works, but others give no output from the php code and no php errors, there's something you are doing differently between the files that isn't correct. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525318 Share on other sites More sharing options...
fatal_banana Posted November 3, 2015 Author Share Posted November 3, 2015 Alrighty so this file is on an internal network so i couldnt copy it over, but when I went back over it again I was missing a semicolon. I did not realize that one missing semi colon would have such a terrible effect. Thanks for the assist! Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525351 Share on other sites More sharing options...
mac_gyver Posted November 3, 2015 Share Posted November 3, 2015 we only see the code you post. it is not missing a ; and does not throw a php syntax error due to that. if you set the php error_reporting/display_errors setting as i suggested, in the php.ini file, and confirmed that the actual settings got changed to those values, you would have been getting a php syntax error at the missing ; do you have php's error_reporting set to E_ALL and display_errors set to ON in the php.ini on your development system so that php would help you by reporting and displaying all the errors that it detects? you will save a ton of time. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1525359 Share on other sites More sharing options...
doni49 Posted November 12, 2015 Share Posted November 12, 2015 One more things to try: before the first <?php place just the word STARTING. Then at the very end of the file (after the last ?>, place the word ENDING. Load the file in your browser. Do you see STARTING and ENDING? If not your server isn't sending the file to the browser. If you do see them, you must have some kind do of php issue. Quote Link to comment https://forums.phpfreaks.com/topic/299018-php-files-not-displaying-in-browser/#findComment-1526258 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.