xFalseProphet Posted August 20, 2014 Share Posted August 20, 2014 This may sound like a really stupid question, but this is really bugging me. If i code something in PHP 5.5.11 and upload it to a server that is running PHP 5.4, would the code work correctly? I didnt think there was a super amount of difference between the two versions. Perhaps im wrong. The reason i asked is because someone has given me a project to help them with. Im running php 5.5.11. I coded it, tested in in xampp, working great. I upload it to his website, which he told me is currently running 5.4 (i tried phpinfo() but they have disabled it) and a majority of the functions i coded are no longer working. Things are not writing to the database, things collected from the database either dont show up on the website or they only show up when something gets posted after it, in which case the something posted after it doesnt show e.c.t. Is the difference that much it can break code? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/290548-php-version-question/ Share on other sites More sharing options...
requinix Posted August 20, 2014 Share Posted August 20, 2014 If you used any PHP 5.5 features then you'd probably be aware of it. More likely is a difference in the configuration between your environment and his. php.ini settings, extensions enabled, database credentials, that kind of thing. Ideally you would be testing your code in an environment that is as close to the real thing as possible - working in XAMPP and deploying to IIS (for example) is just asking for problems. Do a phpinfo() on both setups and see what the differences are. Quote Link to comment https://forums.phpfreaks.com/topic/290548-php-version-question/#findComment-1488377 Share on other sites More sharing options...
xFalseProphet Posted August 20, 2014 Author Share Posted August 20, 2014 Its really frustrating lol. I have tried to do phpinfo() on the server his website is on but its been disabled. I dont think i have used any php 5.5 features that im aware of, but i may be wrong. Quote Link to comment https://forums.phpfreaks.com/topic/290548-php-version-question/#findComment-1488380 Share on other sites More sharing options...
mac_gyver Posted August 20, 2014 Share Posted August 20, 2014 things which are configuration dependent (and php version dependent) will be producing either php syntax or runtime errors. if the pages all actually run at all, then at least the main pages don't contain php syntax errors and you can set php's error_reporting to E_ALL and display_errors to ON in the code to see what errors are being detected by php. you could also post the code here and someone could directly tell you the most likely things it is doing that would be configuration or version dependent. Quote Link to comment https://forums.phpfreaks.com/topic/290548-php-version-question/#findComment-1488381 Share on other sites More sharing options...
xFalseProphet Posted August 20, 2014 Author Share Posted August 20, 2014 I cant post the code here, its a full script. It has around 60 files each with at least 900 lines of code in each lol. I will try running display errors and see what happens. Quote Link to comment https://forums.phpfreaks.com/topic/290548-php-version-question/#findComment-1488382 Share on other sites More sharing options...
Solution kicken Posted August 20, 2014 Solution Share Posted August 20, 2014 Migrating from PHP 5.4.x to PHP 5.5.x That covers things to be aware of regarding differences between the two. Look through it and see if you have used any of the new features. If phpinfo() is disabled, using ini_get_all may work as a way to check INI directives. You could also use extension_loaded or function_exists to test if various extensions or functions that you need are enabled. Quote Link to comment https://forums.phpfreaks.com/topic/290548-php-version-question/#findComment-1488384 Share on other sites More sharing options...
xFalseProphet Posted August 20, 2014 Author Share Posted August 20, 2014 Thank you very much. I checked out your link and nothing there affects my code which made me think it was an sql error. Took a look at my code and it turned out i had missed a comma on one line, and 2 ' on another. I hate missing things like that. Quote Link to comment https://forums.phpfreaks.com/topic/290548-php-version-question/#findComment-1488412 Share on other sites More sharing options...
mac_gyver Posted August 20, 2014 Share Posted August 20, 2014 your testing on the development system should have found things like query errors. your code should also have logic that tests each query to see if it failed or not and take an appropriate action. if a query does fail, you should output a user message - 'Sorry, an error has prevented this page from completing the requested operation' and log the actual query and the database error message. testing is more than just checking that the code runs. it means testing if the code does what you expect for both expected values and unexpected values and making sure that the code produces the expected result for all the possible execution paths/logic branches. Quote Link to comment https://forums.phpfreaks.com/topic/290548-php-version-question/#findComment-1488418 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.