/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] http_build_query error – what does it mean?

Hi
I’m having a problem with this bit of code – it is part of a pagination system I have added to my site

$_GET[‘mOffset’] = $memberOffset+$memberPerPage;
$nextPageURI = http_build_query($_GET);
$nextPageLink = $fullURL.$nextPageURI;

the error I am getting is

Fatal error: Call to undefined function: http_build_query() in /homepages/10/d238492251/htdocs/forums/memberlist.php on line 1699

line 1699 is the middle one of the three lines above
[B]
Thing is I tested all this on my backup site which runs on one of my local PCs and everything works fine there[/B]
– it’s only when I sent the files to my live site that I have this problem

What causes this and more importantly how do I fix it?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogFeb 07.2011 — My first guess would be that you are not running at least PHP 5.0. (Since PHP4 has not been supported at all -- including security patches -- for a couple of years now, it's probably time to upgrade or change hosts if that is the case.)
Copy linkTweet thisAlerts:
@dicky96authorFeb 07.2011 — Yes my host 1&1 internet runs php4 by default - I have spoke to them on the phone this last half hour

That seems a bit mad to me but anyway they said if I create a file called .htaccess

and add a line

AddType x-mapp-php5 .php

and ftp this to the root folder of my site then it will switch to running php 5

I was a bit surprised to hear this is needed myself!

They also have this information

PHP5 has register_globals, allow_url_include and allow_url_fopen all disabled by default which may cause improper functionality for some scripts when switching from PHP4 to PHP5

I'm not sure if that would affect my very modified vbulletin 3.7 based site - the test version of the site runs OK on php 5.0 but how do I check these settings on my test server to see what I have set there?

Rich
Copy linkTweet thisAlerts:
@NogDogFeb 07.2011 — If your vBulletin version is at all up to date, I cannot imagine that it would depend on register_globals, which has been deprecated for years. The other settings probably won't matter either, as I can't imagine it would want/need to include() from remote URL's, and probably not likely to need to fopen() remote files, either. But anyway, probably the simplest way to check any of those settings is to just make a little test script:
[code=php]
<?php
$settings = array('register_globals', 'allow_url_include', 'allow_url_fopen');
foreach($settings as $setting) {
echo "<p>$setting: " . ini_get($setting) . "</p>n";
}
[/code]

But that only tells you what your PHP configuration is -- just because a feature is enabled does not mean that anything is using it.
Copy linkTweet thisAlerts:
@dicky96authorFeb 08.2011 — Thanks for the help, useful as ever ?

I put that .htaccess in my live site root folder and now it's running PHP5 the problem is solved. Also as a huge bonus.... the site seems to be running a lot faster than before! Is that normal when changing to php5?

Rich
Copy linkTweet thisAlerts:
@NogDogFeb 08.2011 — It's possible that some functions you are using had their performance improved in PHP5. Also, sites that run both 4 and 5 typically run one as an Apache module and the other as CGI, and the CGI version tends to be a bit slower as it has to be launched for each page request, whereas the Apache module is always running (once Apache itself is running). Anyway, in your case just consider it a bonus for moving up to where you should have been anyway. ?
×

Success!

Help @dicky96 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...