Can anyone recommend some free PHP/MySQL web hosting?


I tried, unfortunately I’m using some code which is PHP 5.3 and they are using 5.2, so my site doesn’t work there.

I’m looking for some free hosting, just for testing, with the latest version of PHP and MySQL with phpMyAdmin.

Any recommendations?

Why don’t you set up you own local server, for Windows it’s either WAMP or XAMPP?

Why don’t you set up you own local server, for Windows it’s either WAMP or XAMPP?

Already done that, just wanted somewhere to put stuff to show people.

I really doubt you’ll find something decent that’s also free. There are hosts for under $10 a month

It looks that way, I’ve tried three so far and my site doesn’t work on any of them - it all works perfectly on my local Windows box. I think the problems are related to my using INNODB instead of MYISAM and some code that is PHP 5.3 >.

I think those differences are pretty minimal. I can only think of a couple functions that added extra params in 5.3 that don’t work in 5.2 like the strstr() function which added $before_needle in 5.3

There is actually a page here that may help explain 5.2 -> 5.3 changes

Some of my problems are because I’ve used mysqli_fetch_all(), but I’m slightly mystified by some of the other issues.

For example here is my log in page:, which if I click submit, gives this error:

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /data/multiserv/users/1098223/projects/2448158/www/Login.php on line 11

Here is the code for the page:


<?php include "Includes/incConnection.php"; ?> <?php if (isset($_GET["Status"])) {$intStatus=funcStripText($_GET["Status"]);} else{$intStatus=0;} if (isset($_POST["Submit"])){ $strUser = funcStripText($_POST["txtUser"]); $strPass = funcStripText($_POST["txtPass"]); if (($strUser != "")&&($strPass != "")){ $rsRow = mysqli_query($connBike, "SELECT UserID FROM tbl_Users WHERE Username='" . $strUser . "' AND UserPass='" . $strPass ."'"); if (mysqli_num_rows($rsRow)>0){ // <--- Line 11 $rsDetails = mysqli_fetch_assoc($rsRow); mysqli_free_result($rsRow); mysqli_close($connBike); $_SESSION["UserID"] = $rsDetails["UserID"]; $intStatus = 1; } else{ $intStatus = 2; } } } ?> [/php]

And here’s the code for the included file:


<?php // Create connection $connBike=mysqli_connect("host","user","pasword","db_bike"); //Local // Check connection if (mysqli_connect_errno($connBike)){ echo "Failed to connect to MySQL: " . mysqli_connect_error(); } function funcStripText($strText){ if (is_numeric($strText)==false){ $arrBadWords = array("db_", "tbl_", ";", "--", "({", "/*", "xp_", "dt_", "varchar"); $strText = str_ireplace($arrBadWords, "", $strText); $strText = str_replace("'", "''", $strText); $strText = str_replace("<", "<", $strText); $strText = str_replace(">", ">", $strText); } return $strText; } setlocale(LC_ALL, "en_GB"); session_start(); ?>


xerxes i’d be happy to give you 500MB on my server for a couple of weeks for testing if that’s any help to you ?

Apache version 2.2.23
PHP version 5.3.20
MySQL version 5.1.68-cll
Architecture i686
Operating system linux
Perl version 5.8.8

The only thing is you would need to point a domain name to my nameservers.

That’s very kind of you, however I don’t have an unused domain to point at it at the moment.

I should be alright next week, another web developer, with whom I work regularly, will be back from overseas and should be able to set up some space for me on a dedicated server, where we will have some control over PHP and MySQL versions.

Being new to PHP/MySQL I was keen to see how setting up a site on a remote server compared to ASP/VBScript/SQL Server and to some extent I’ve answered that question; not really any more difficult, but there are obviously a few things to consider. :smiley:

To some extent, I think my problems are because I’ve only just started using PHP and have the latest versions of everything installed locally and have been referring to the on-line documentation and happily using the latest code.

Do better, paid hosting providers keep their servers more up to date?

Yes as a general rule Paid Hosting Providers do keep things more up to date. I have a re-seller Hosting plan which i have never had any problems with. I have a spare, unused domain name which you are welcome to borrow and it is set up on my server now … Offer still stands. If you wish to use it for a couple of weeks until you get set up then just PM me and i will give you passwords etc .

Best of luck !

mysqli_query will return false on failure which would send a boolean value to mysqli_num_rows

You should always add error reporting for queries e.g.

$rsRow = mysqli_query($connBike, “SELECT UserID FROM tbl_Users WHERE Username=’” . $strUser . “’ AND UserPass=’” . $strPass ."’");
if (!$rsRow) {
printf(“Errormessage: %s\n”, mysqli_error($connBike));

The problem with that is that the error report line:

printf(“Errormessage: %s\n”, mysqli_error($connBike));

Would also fail, because it uses mysqli. :smiley:

I don’t understand what you mean.

If the error is because mysqli is too new, using mysqli to retrieve the error isn’t going to reveal anything.

Too new? I’m sorry I still have no idea what you are trying to say heh. Did you try the code?

mysqli is PHP > 5, if the server has an older version, you just get an error something like “Fatal Error invalid function call mysqli_query…”

See what I mean?

Sure, but that isn’t the error you are getting?

Ah, OK, not that one specifically, but I tried three different free hosts and got different errors, all of them relating to incompatible PHP versions.

Never had this trouble with Windows/IIS/ASP/SQL Server. ;D

I see. Well if you find a host that is using less than PHP 5 you should avoid it.

Sponsor our Newsletter | Privacy Policy | Terms of Service