WorldwideGaming Posted June 26, 2023 Share Posted June 26, 2023 Older database developer here. Never really used PHP except for minor fixes to existing code here and there, so basically a newbie w/ PHP. Anyway, I've got some PHP that I tossed together to create a basic Google Product feed file. It was running fine until we switched back end Linux servers. As far as I can tell, there must've been a change to the revision of PHP installed (both were/are on PHP 7.4.x, with the current server running 7.4.33. Not sure what the old server was on other than 7.4.x). I'm REALLY hoping someone can spot the issue straight away! I'll attach the PHP script and a screenshot of what's showing in the web browser and maybe someone here can point me in the right direction. THANK YOU IN ADVANCE! ProdFeedGen.txt Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/ Share on other sites More sharing options...
Barand Posted June 26, 2023 Share Posted June 26, 2023 You're best bet is to turn on display_errors in your php.ini file and also set the error reporting level to E_ALL. See what error messages you get. Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610022 Share on other sites More sharing options...
WorldwideGaming Posted June 26, 2023 Author Share Posted June 26, 2023 27 minutes ago, Barand said: You're best bet is to turn on display_errors in your php.ini file and also set the error reporting level to E_ALL. See what error messages you get. Error logging is already enabled and the log file for my VHOST is empty. Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610024 Share on other sites More sharing options...
WorldwideGaming Posted June 26, 2023 Author Share Posted June 26, 2023 46 minutes ago, Barand said: You're best bet is to turn on display_errors in your php.ini file and also set the error reporting level to E_ALL. See what error messages you get. I've got all my PHP error logging being sent to its own file one level up from my webroot (set inside the CLI php.ini file, along with display_errors and reporting level). Running the script generates no errors - just the output in the attached screenshot on the original message. Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610025 Share on other sites More sharing options...
ginerjm Posted June 26, 2023 Share Posted June 26, 2023 If you want to show us this error setting code (and more) please post readable real code and not some image of it. That way somebody might play with it and test it out perhaps. Can't do that with a pic. Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610026 Share on other sites More sharing options...
WorldwideGaming Posted June 26, 2023 Author Share Posted June 26, 2023 4 minutes ago, ginerjm said: If you want to show us this error setting code (and more) please post readable real code and not some image of it. That way somebody might play with it and test it out perhaps. Can't do that with a pic. The PHP code is in the TXT file attached to the original post. The screenshot is the output in the web browser from trying to execute the code. Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610027 Share on other sites More sharing options...
ginerjm Posted June 26, 2023 Share Posted June 26, 2023 A lot of people - like me - don't open up attachments. If you have SOME code that you want looked at, post it here using the <> tag to frame it. We aren't interested in the html and JS and CSS, mostly just the PHP. Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610028 Share on other sites More sharing options...
Barand Posted June 26, 2023 Share Posted June 26, 2023 Your browser should not be showing any php code if it is executed correctly. Are you just opening the file in the browser (like a text file)? You need to open it as a url, eg http://localhost/myfile.php Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610029 Share on other sites More sharing options...
dodgeitorelse3 Posted June 26, 2023 Share Posted June 26, 2023 (edited) changing your code from php short tag to <?php and then adding error reporting and display errors as such displays <?php error_reporting(E_ALL); ini_set('display_errors', '1'); Warning: require_once(/var/www/vhosts/worldwide-gaming.com/httpdocs/squirrelcart/pre_common.php): failed to open stream: No such file or directory in /var/www/html/ProdFeedGen.php on line 6 Fatal error: require_once(): Failed opening required '/var/www/vhosts/worldwide-gaming.com/httpdocs/squirrelcart/pre_common.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/ProdFeedGen.php on line 6 and does not print code to screen. These errors show for me due to the fact I am not using a full url to get to your require once file. Edited June 26, 2023 by dodgeitorelse3 Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610030 Share on other sites More sharing options...
WorldwideGaming Posted June 26, 2023 Author Share Posted June 26, 2023 Thanks for all the assistance! Turned out the php short tag had the 'php' part of it stripped out somehow. Added it back and boom, works. No idea how it happened, but thanks to dodgeitorelse3 for pointing out the error reporting idea as that's what had me go back and look. Thanks again all! Quote Link to comment https://forums.phpfreaks.com/topic/317011-could-really-use-some-basic-assistance-please/#findComment-1610031 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.