Jump to content

filter_var or server (Answered)


Illasera

Recommended Posts

I have the following code,

if($_POST['register']){$pr_email  = $_POST['r_email'];$email_check = filter_var($pr_email, FILTER_VALIDATE_EMAIL);...}

Basicly there is a form that validates itself, Works perfectly on my localhost with the newest php version,But failing on my hosting server that support php...The page stop loading when it hits the filter_var function, without reporting any errors, Its just kills the script and stop loading the page (no die/break/return jump conditions include to kill the script)What could cause this problem? mismatch server php version?or maybe something else?

Link to comment
Share on other sites

depends if you use the correct extension .php5 if you dont it may revert to older version, to force all .php to version 5 use .htacces and add AddType x-mapp-php5 .php
Huh?Guess it will take me sometime to resolve what you just typed :) , Guess ill start working on it...- Please note that the issue is with the server am renting, So it`s not something i have locally that i can add/tweak stuff...
Link to comment
Share on other sites

i had the same problem with joomla, server set up to use php5, created some code, which would only work in php5, and it did not want to know, it just did not recognize it, after looking at system info in joomla backend, it said i was still using version 4. something. searched joomla forum, and found that because joomla files did not use extension .php5 but just .php it would revert to the old version, unless you use AddType x-mapp-php5 .php in .htaccess, did that! and problem solved!.

Link to comment
Share on other sites

i had the same problem with joomla, server set up to use php5, created some code, which would only work in php5, and it did not want to know, it just did not recognize it, after looking at system info in joomla backend, it said i was still using version 4. something. searched joomla forum, and found that because joomla files did not use extension .php5 but just .php it would revert to the old version, unless you use AddType x-mapp-php5 .php in .htaccess, did that! and problem solved!.
Care to give a little bit more info about the phrase "AddType x-mapp-php5 .php in .htaccess" ?or maybe link me to somewhere i could get some pointers about it?Notice that their server wrote the current version is 5.1.6, with phpinfo()...
Link to comment
Share on other sites

It sounds like this might not be the problem in your case, but if it is, heres an instruction on how to implement it.You may choose to simply name the script with the .php5 file extension if there are only a few scripts that require PHP5. If you don't want to rename all your scripts to .php5, you can do the create a .htaccess file (or edit the existing .htaccess file, if you already have one). You can create this file using a text editor such as Notepad, WordPad, vi, nano, etc. and place the following line in the text file: AddType x-mapp-php5 .php Save the text file as .htaccess in the folder where you need to use PHP5 (or upload the file to the correct folder). The settings specified in the .htaccess file are recursive meaning that the settings will apply to the current folder where the file is saved as well as all subfolders.

Link to comment
Share on other sites

It sounds like this might not be the problem in your case, but if it is, heres an instruction on how to implement it.You may choose to simply name the script with the .php5 file extension if there are only a few scripts that require PHP5. If you don't want to rename all your scripts to .php5, you can do the create a .htaccess file (or edit the existing .htaccess file, if you already have one). You can create this file using a text editor such as Notepad, WordPad, vi, nano, etc. and place the following line in the text file: AddType x-mapp-php5 .php Save the text file as .htaccess in the folder where you need to use PHP5 (or upload the file to the correct folder). The settings specified in the .htaccess file are recursive meaning that the settings will apply to the current folder where the file is saved as well as all subfolders.
I have done as you instructed and no change, Are you sure it has nothing to do with the fact they are using a lesser subversion of php 5?I mean 5.1.6 Is quite old...
Link to comment
Share on other sites

I have done as you instructed and no change, Are you sure it has nothing to do with the fact they are using a lesser subversion of php 5?I mean 5.1.6 Is quite old...
Wait, so you already knew the exact PHP version you had? Damn... then you should've said it up front (as the first reply to dsonesuk). The .htaccess stuff is useful in case your host was having PHP4, but not when we talk about another PHP5 version.filter_var() is indeed available only in PHP 5.2 and above, as you can see at the top of the manual page. So yes, their old PHP version is the problem. You should contact your host, and ask them to upgrade, ideally to PHP 5.3.2, and hopefully, they'd also agree to keep themselves current, and update shortly after every new PHP release.
Link to comment
Share on other sites

Wait, so you already knew the exact PHP version you had? Damn... then you should've said it up front (as the first reply to dsonesuk). The .htaccess stuff is useful in case your host was having PHP4, but not when we talk about another PHP5 version.filter_var() is indeed available only in PHP 5.2 and above, as you can see at the top of the manual page. So yes, their old PHP version is the problem. You should contact your host, and ask them to upgrate, ideally to PHP 5.3.2, and hopefully, they'd also agree to keep themselves current, and update shortly after every new PHP release.
Thank you mate, Sorry for not keeping you guys posted on time.I talked to them(The server that provides my website storage), They told me "Buy VPS, The module we are using to host(Plask 8.5) support PHP 5.1.6,Or wait for the upgrade(plask 10) that will be released in 6 more months, If not just go F yourself (But in much more respected words)...The big problem is many funcions , such as overwriting PEAR to send authenticated mail via SMTP also require higher version and other stuff that i use as well... No idea what to do, Probably swap to another server for website storage, But the problem is , Most providers in my vicinity use the same Plask version that doesnt support the latest php, So does that mean VPS?
Link to comment
Share on other sites

VPS? Virtual Private Server? That's always an option. It basically means "do whatever you want, keep yourself isolated, run on the same hardware". The best of almost all worlds (hardware excluded).If you can afford it, sure... if you can't... look for another host, and if they don't make their PHP version public, ask them in advance, and more importantly - ask them what's their upgrade policy, also specifying that you'd be most satisfied if they adopt every stable version of each component.

Link to comment
Share on other sites

VPS? Virtual Private Server? That's always an option. It basically means "do whatever you want, keep yourself isolated, run on the same hardware". The best of almost all worlds (hardware excluded).If you can afford it, sure... if you can't... look for another host, and if they don't make their PHP version public, ask them in advance, and more importantly - ask them what's their upgrade policy, also specifying that you'd be most satisfied if they adopt every stable version of each component.
Thank you mate :) That will help me with my problem, Of course, am not eager to solve it that way... But it seems like i have no choice...VPS = Paying extra,Other server - Need to start the entire renting procedure again, Am sure you already know "How fun it is"...
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...