www.webdeveloper.com
Results 1 to 12 of 12

Thread: PHP 5.2 to 5.3

  1. #1
    Join Date
    Jun 2008
    Posts
    33

    PHP 5.2 to 5.3

    Hi,


    I bought a little software 4 years ago which I really like. It was written for the PHP 5.2 server.

    I use to be able to install it and run it on my hosting server, but now errors are popping up everywhere because the server is now 5.3.

    Is there anyway I can update my software so it'll work on the 5.3 server?

    Like a step by step instructions - find and replace this (code) by this (code) way to do it?

    Thanks much.

    Any help would be much appreciated.

    Fagin

  2. #2
    Join Date
    Jul 2007
    Location
    Wisconsin
    Posts
    468
    Short Answer: No.

    I would suggest starting with php.net's migration outline.

    DO NOT just "replace this code with that code", without understanding what "this code" was doing, and how "that code" is different. You'll end up in a worse place than you started. (we're in the process of migrating about 150 websites from

    What error are popping up? Give us a little something to work with, so we can help point in the right direction.

  3. #3
    Join Date
    Jun 2008
    Posts
    33
    Thanks for your reply.
    I didn't really think that it was as simple as replacing the syntax...was just laying out my level of ignorance in the field, really

    Well, the very first error I see is when I try to install the software - one of the tables couldn't be set up --

    Table 4: RDV could not be created (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(14), cap varchar(255), app_length varchar(255), ' at line 5)

    One or more errors have occurred. The tables could not be set up properly. Please go back
    and check your entries (capitalization, password etc.).

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,158
    Looks like a MySQL error, not a PHP error.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Jun 2008
    Posts
    33
    That's what someone else told me- that it is a MySQL error. Although, those same errors did not exist when it was in the PHP 5.2 server.

    Sheesh. It's frustrating to be a NOOBIE learning PHP when you want to build the house without cutting the logs first.

    I like your Terry Pratchett quote by the way. It is so true.

  6. #6
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,158
    All the error is telling us is that MySQL ran into a syntax error in the SQL that was sent to it by your PHP script. Until we can find and look at that actual SQL statement, it will be pretty hard to find what that actual problem is. It's entirely possible that when they updated your PHP version, they also updated MySQL, so it could possibly a version issue, though I'd place a small wager it's something different in the MySQL configuration, not MySQL itself.

    PS: You didn't by any chance migrate from a Windows server to a Linux-type server, did you? Windows doesn't care about upper-/lower-case letters in file names, whereas Linux does, and since MySQL depends on file names for a lot of things, the hint from the error message about capitalization might actually be helpful (but you'd still have to find the query in your code to figure out what needs to be edited).
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  7. #7
    Join Date
    Jun 2008
    Posts
    33
    To be honest, I don't know if it's a windows or a linux server. Though, I believe you are right about my hoster updating the MySQL at the sametime they migrate PHP 5.2 to 5.3.

    It turns out that I couldn't install the software because Timestamp (14) was being used on the install.php

    I had fixed that and the install went through successfully.

    Now in testing the functionalites of the software, I get these errors:

    1. Function eregi() is deprecated in /home/./www/www/././list.php

    2. Assigning the return value of new by reference is deprecated in /home/./www/www/././update.class.inc.php

    3. Deprecated: Function split() is deprecated in /home/./www/www/././calendargrid.inc.php on line 51

    Which I guess is a good thing, they seem to be very specific problems and are related to PHP this time,
    I found this help manual on the migration from 5.2 to 5.3.
    http://php.net/manual/en/migration53.php
    Am going to read it and see if I can't fix it.

    Anyways, my eyeballs are fried from staring at the screen for 12 hours straight.
    Am going to call it a day. I'll resume my repair quest tomorrow.

    Thanks NogDog for your help. Have a good one!

  8. #8
    Join Date
    Jun 2008
    Posts
    33
    Hi again everyone,

    I was able to successfully update my software from PHP 5.2 to 5.3 with the help of this manual http://www.php.net/manual/en/migration53.deprecated.php

    There was just one last thing that I did not understand :
    Deprecated: Assigning the return value of new by reference is deprecated in /soc/update.php on line 139

    Although, on the advice found on other forums, removing the (&) sign appears to have worked, I still would like to make sure that it is the thing to do, that is, I'd like to understand it - and not just simply do it. Are there any gurus here that can put it in layman's term for me?

    Thanks much for your help . The code in question I changed was this -

    $renderer =& new HTML_QuickForm_Renderer_ArraySmarty($out->get_object, true);

    to

    $renderer = new HTML_QuickForm_Renderer_ArraySmarty($out->get_object, true);

  9. #9
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,158
    I'm guessing a lot of those notices are not so much a 5.2 to 5.3 thing as it is different error_reporting settings. The assigning by reference thing I believe is more of a PHP 4.x to PHP 5.x issue, as in PHP 5 passing objects by reference became the default behavior. In PHP 4, there was at least a belief among some PHP developers that using "= & new" instead of just "= new" would improve performance. Whether or not it really had any measurable effect is now essentially a moot point in PHP 5.

    So, while you likely could have "fixed" most of your new errors by simply lowering the error_reporting level (since they were just notices, not truly "errors"), it's good that you're fixing them now, in case they ever do become real errors in later versions.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  10. #10
    Join Date
    Jun 2008
    Posts
    33
    Thanks NogDog,

    I'm glad I was able to fix it on my own. I couldn't afford a reputable, trustworthy developer to fix it.
    I tried to hire someone via a website where developers from beyond the borders were offering their service at a price I can afford.
    After the one I was about to hire, whose English was deplorable, INSISTED they needed the "details to access my Cpanel and my database so that they could look at its structure" to do the job and that accessing the files via FTP was not enough -- I said...WOH!
    Last edited by fagin; 02-09-2013 at 03:01 PM.

  11. #11
    Join Date
    Feb 2013
    Posts
    11
    give the full tutorial of php please

  12. #12
    Join Date
    Jun 2008
    Posts
    33
    Quote Originally Posted by zeeshanaayan07 View Post
    give the full tutorial of php please
    Not quite sure I understand your request.
    I don't know PHP well enough to give a tutorial of any kind. I'm a noobie.
    But if you mean the steps I took to upgrade the software from PHP 5.2 to PHP 5.3,
    What I did was look up the meaning of "Deprecated" found here : http://en.wikipedia.org/wiki/Deprecated.
    Then, I went here : http://www.php.net/manual/en/migration53.deprecated.php
    After, I tackled the error messages appearing on the screen one by one using the manual above to replace the deprecated functions with the PHP 5.3 replacements.
    Finally, I tested my software to make sure all the functionalities are not messed up in anyway and that it is working as usual as before.

    Hope this answers your question.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles