Copy/pasted from old server, now php not working

Today I decided to take some time and upload my backed up website to the new server, as per your instructions.
All was not fine, cause your tutorials and guides are just not compatible with the actual process (need to delete your account between 2 steps, but it doesnā€™t say that at all. Took me 15 frustrating minutes to figure out what was going on thereā€¦ great job!) But then I managed to get through, managed to get through that horrible step-by-step instruction thing as well, it just kept hanging on steps cause of buttons that are not really obviousā€¦
Then I finally got my website back running (www.broos.tk), only to notice that my PHP is not being recognized by the serverā€¦ I tried setting the PHP version to 5.2 and 5.4 but for some reason, the webserver is just not processingā€¦
I even tried uploading a simple <? echo 'test'; ?>
and that didnā€™t even workā€¦ Whatā€™s up with the new server guys? Did I migrate to a broken system?

Migrating like this should not be this difficult, or frustrating, in fact, it shouldnā€™t have to happen at all (you couldā€™ve just updated our control panels without us having to move our data around)ā€¦

I figured it out, apparently, someone decided not to recognize php as <? ?> anymore, although itā€™s been a standard for 20 yearsā€¦

However, half of my myself queries etc. do not work anymoreā€¦ Itā€™s selecting fine, but not updating or inserting :S

This is really pissing me offā€¦

I see youā€™re trying to use php short tagsā€¦
To use php short tags you need to follow this tutorial.

Thanks for your reply, but I already figured out that issueā€¦
Trying to solve why my sql queries are not recognized now, probably also because Iā€™m using the method that was standard for 15 years and now has been disabledā€¦

Also, this basically means that your PHP version thingie doesnā€™t work - since the mysql_query() function should still be working pre-php 7.00

If youā€™re using ā€œmysqlā€ function(not ā€œmysqliā€)ā€¦then you need to downgrade to php version 5.4 or even less.
To downgrade phpversion ā€œsettingsā€ ā€“ ā€œgeneralā€ --ā€œphp versionā€

As I said, that doesnā€™t work.

Can you post your php script which you said is not working.

it was never a standard. It was deprecated years ago. Mainly because of the confusion to the same syntax for <?xml tags.

Not going to share the entire code, but hereā€™s the line that Iā€™m still having trouble with (when using single quotes in msgBody)

$_POST[title]=htmlspecialchars($_POST[title]);
$_POST[msgBody]=htmlspecialchars($_POST[msgBody]);
mysqli_query($link,"UPDATE `blogs` SET `title`='$_POST[title]', `blog`='$_POST[msgBody]', `tag`='$tagID' WHERE `ID`=$blog[ID]") or die(mysqli_error($link));

This line used to work perfect, but as soon as I enter single quotes in the text, it gives an SQL-statement parse-errorā€¦

Fixed that by adding mysqli_real_escape_string() to the code, never used to be necessary, because htmlspecialchars() already does thatā€¦

Well, considering Iā€™ve been using <? ?> for over 20 years on a wide range of servers, both locally hosted and hosted by national and international companies, both Windows and *nix, both embedded and full system, I respectfully disagree with them ā€˜not being a standardā€™.
They are still enabled by default by most hosting companies and servers where I have my little projects, yet you decided not to enable them by defaultā€¦ Thatā€™s fine, but a headsup wouldā€™ve been niceā€¦

1 Like

I have taken this from official php.net documentation:

http://php.net/manual/en/language.basic-syntax.phptags.php

PHP also allows for short open tag <? (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option).

When official documentation states that it is discouraged i do not consider this as a standard :slight_smile:

Also you can enable short tags if you prefer:

Itā€™s discouraged because it needs to be enabled on the server.
It can be considered a standard, when itā€™s enabled by ā€˜mostā€™ companies.

Heck, you guys had it enabled by default before as wellā€¦

Not a direct security vulnerability but it could become one given the proper conditions.

so there is more than one reason to not include short tags by default

I have the same issueā€¦ But Iā€™m already using long php tags (<?php echo "test"; ?>) and itā€™s not working in .html fileā€¦ :confused:

This is different issue discussed here

Okayā€¦ I read about that also before but here again, Iā€™m just wondering why it worked before and doesnā€™t work anymore with the new panelā€¦
Anyways I got it all fixed nowā€¦ Hope it was worth the effort :wink: