473,804 Members | 3,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP4 to PHP5

I'm working on a server that is running PHP4.

I'd like to upgrade this so I can use the PHP5 code I have already.

What kind, if any, problems will I have with the existing PHP code base?

I see:

Local Master

magic_quotes_gp c On On
magic_quotes_ru ntime Off Off

I'm not sure what that means. I think that means that anything coming in
on $_REQUEST is backslashed and I'm thinking that probably won't play
well with PDO. If I turn that off what kind of failure could I see in
the existing code? Is that only a problem in that single quotes will be
backslashed in the data? Or can I have runtime crashes?

Jeff
Jul 19 '08 #1
14 1726
I'm working on a server that is running PHP4.
>
I'd like to upgrade this so I can use the PHP5 code I have already.

What kind, if any, problems will I have with the existing PHP code
base?
I see:

Local Master

magic_quotes_gp c On On
magic_quotes_ru ntime Off Off

I'm not sure what that means. I think that means that anything coming
in on $_REQUEST is backslashed and I'm thinking that probably won't
play well with PDO. If I turn that off what kind of failure could I
see in the existing code? Is that only a problem in that single
quotes will be backslashed in the data? Or can I have runtime crashes?

Jeff
We probably don't have similar code, but I made the switch and had zero
problems of any kind. The only problem I ran into was I discovered
filter_var in 5.2.5 and then discovered my ISP is only at 5.2.2, which
doesn't support it. So at least from my viewpoint, I'd say just make
sure you're at the same level your server provides. I just made the
switch on the server and ran a phpinfo() to get the full rev, then ran
one on my own system and compared the two. Past 5.2.2 there were some
pretty useful additions but I don't know them all by heart.

HTH

Twayne
Jul 20 '08 #2
Jeff wrote:
I'm working on a server that is running PHP4.

I'd like to upgrade this so I can use the PHP5 code I have already.

What kind, if any, problems will I have with the existing PHP code base?

I see:

Local Master

magic_quotes_gp c On On
magic_quotes_ru ntime Off Off

I'm not sure what that means. I think that means that anything coming in
on $_REQUEST is backslashed and I'm thinking that probably won't play
well with PDO. If I turn that off what kind of failure could I see in
the existing code? Is that only a problem in that single quotes will be
backslashed in the data? Or can I have runtime crashes?

Jeff
The change from php4 to php5 probably won't be too painful. Virtually
everything I've written for php4 runs fine on php5.

The magic_quotes_gp c may be another problem, however. You should have
it off (it will be removed in php6 because it never really worked). If
you've been depending on it being on, you'll have some code to change.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jul 20 '08 #3
Jeff wrote:
I'm working on a server that is running PHP4.

I'd like to upgrade this so I can use the PHP5 code I have already.

What kind, if any, problems will I have with the existing PHP code base?

I see:

Local Master

magic_quotes_gp c On On
magic_quotes_ru ntime Off Off

I'm not sure what that means. I think that means that anything coming in
on $_REQUEST is backslashed and I'm thinking that probably won't play
well with PDO. If I turn that off what kind of failure could I see in
the existing code? Is that only a problem in that single quotes will be
backslashed in the data? Or can I have runtime crashes?

Jeff


Just yesterday I ran into a problem with an old script I hadn't used in
a very long while. It accessed uploaded files via $HTTP_POST_FILE S,
which was still around in Php 4, but is gone in Php 5 (use $_FILES).

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
*************** *************** *****

Jul 20 '08 #4
Chuck Anderson wrote:
Jeff wrote:
> I'm working on a server that is running PHP4.

I'd like to upgrade this so I can use the PHP5 code I have already.

What kind, if any, problems will I have with the existing PHP code
base?

I see:

Local Master

magic_quotes_g pc On On
magic_quotes_r untime Off Off

I'm not sure what that means. I think that means that anything coming
in on $_REQUEST is backslashed and I'm thinking that probably won't
play well with PDO. If I turn that off what kind of failure could I
see in the existing code? Is that only a problem in that single quotes
will be backslashed in the data? Or can I have runtime crashes?

Jeff



Just yesterday I ran into a problem with an old script I hadn't used in
a very long while. It accessed uploaded files via $HTTP_POST_FILE S,
which was still around in Php 4, but is gone in Php 5 (use $_FILES).
Yes, that could be. But even $HTTP_POST_FILE S is still available (but
deprecated). You enable it with register_long_a rrays=on in the php.ini
file.

BTW - $_FILES and the rest have been around since php 4.1. Any code
written since then should be using the new arrays. But I also suspect
your code was written before then :-)

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jul 20 '08 #5
Jerry Stuckle wrote:
Jeff wrote:
> I'm working on a server that is running PHP4.

I'd like to upgrade this so I can use the PHP5 code I have already.

What kind, if any, problems will I have with the existing PHP code
base?

I see:

Local Master

magic_quotes_g pc On On
magic_quotes_r untime Off Off

I'm not sure what that means. I think that means that anything coming
in on $_REQUEST is backslashed and I'm thinking that probably won't
play well with PDO. If I turn that off what kind of failure could I
see in the existing code? Is that only a problem in that single quotes
will be backslashed in the data? Or can I have runtime crashes?

Jeff

The change from php4 to php5 probably won't be too painful. Virtually
everything I've written for php4 runs fine on php5.

The magic_quotes_gp c may be another problem, however. You should have
it off (it will be removed in php6 because it never really worked). If
you've been depending on it being on, you'll have some code to change.
This is the code I wrote, if I need to deal with the possibility of
magic_quotes_gp c being enabled. I don't know if this is the best, most
efficient approach, though:

<?php
if ( get_magic_quote s_gpc() ) {
$lambda = create_function ('&$str,$key',' $str=stripslash es($str);');
array_walk_recu rsive($_GET, $lambda);
array_walk_recu rsive($_POST, $lambda);
array_walk_recu rsive($_COOKIE, $lambda);
}
?>

--
Curtis (http://dyersweb.com)
Jul 20 '08 #6
Curtis wrote:
Jerry Stuckle wrote:
>Jeff wrote:
>> I'm working on a server that is running PHP4.

I'd like to upgrade this so I can use the PHP5 code I have already.

What kind, if any, problems will I have with the existing PHP code
base?

I see:

Local Master

magic_quotes_ gpc On On
magic_quotes_ runtime Off Off

I'm not sure what that means. I think that means that anything coming
in on $_REQUEST is backslashed and I'm thinking that probably won't
play well with PDO. If I turn that off what kind of failure could I
see in the existing code? Is that only a problem in that single
quotes will be backslashed in the data? Or can I have runtime crashes?

Jeff

The change from php4 to php5 probably won't be too painful. Virtually
everything I've written for php4 runs fine on php5.

The magic_quotes_gp c may be another problem, however. You should have
it off (it will be removed in php6 because it never really worked).
If you've been depending on it being on, you'll have some code to change.

This is the code I wrote, if I need to deal with the possibility of
magic_quotes_gp c being enabled. I don't know if this is the best, most
efficient approach, though:

<?php
if ( get_magic_quote s_gpc() ) {
$lambda = create_function ('&$str,$key',' $str=stripslash es($str);');
array_walk_recu rsive($_GET, $lambda);
array_walk_recu rsive($_POST, $lambda);
array_walk_recu rsive($_COOKIE, $lambda);
}
?>
Thanks, I've added that to my php code snippets library.

I think it's more likely that I may need to turn on magic_quotes_gp c in
some existing code. No telling what may be there until someone
complains! I'm not particularly wanting to spider 60 domains and check
the code, there's enough I don't get paid for now!

I think PHP suffers from the same problem that ASP does. It's
perfectly easy for any idiot to write the most horrible unmaintainable crap!

Jeff
>
--
Curtis (http://dyersweb.com)
Jul 20 '08 #7
Jeff wrote:
Curtis wrote:
>Jerry Stuckle wrote:
>>Jeff wrote:
I'm working on a server that is running PHP4.

I'd like to upgrade this so I can use the PHP5 code I have already.

What kind, if any, problems will I have with the existing PHP code
base?

I see:

Local Master

magic_quotes _gpc On On
magic_quotes _runtime Off Off

I'm not sure what that means. I think that means that anything
coming in on $_REQUEST is backslashed and I'm thinking that probably
won't play well with PDO. If I turn that off what kind of failure
could I see in the existing code? Is that only a problem in that
single quotes will be backslashed in the data? Or can I have runtime
crashes?

Jeff
The change from php4 to php5 probably won't be too painful.
Virtually everything I've written for php4 runs fine on php5.

The magic_quotes_gp c may be another problem, however. You should
have it off (it will be removed in php6 because it never really
worked). If you've been depending on it being on, you'll have some
code to change.

This is the code I wrote, if I need to deal with the possibility of
magic_quotes_g pc being enabled. I don't know if this is the best, most
efficient approach, though:

<?php
if ( get_magic_quote s_gpc() ) {
$lambda = create_function ('&$str,$key',' $str=stripslash es($str);');
array_walk_recu rsive($_GET, $lambda);
array_walk_recu rsive($_POST, $lambda);
array_walk_recu rsive($_COOKIE, $lambda);
}
?>

Thanks, I've added that to my php code snippets library.

I think it's more likely that I may need to turn on magic_quotes_gp c in
some existing code. No telling what may be there until someone
complains! I'm not particularly wanting to spider 60 domains and check
the code, there's enough I don't get paid for now!

I think PHP suffers from the same problem that ASP does. It's
perfectly easy for any idiot to write the most horrible unmaintainable
crap!
I have programmed in Fortran, PL/1, C, Java, Basic, Pascal, Cobol, PHP,
VB, DCL, sh, csh, etc. and there isn't a language that I have seen that
can prevent "any idiot to write the most horrible unmaintainable crap".
Jul 20 '08 #8
sheldonlg wrote:
Jeff wrote:
>Curtis wrote:
>>Jerry Stuckle wrote:
Jeff wrote:
I'm working on a server that is running PHP4.
>
I'd like to upgrade this so I can use the PHP5 code I have already.
>
What kind, if any, problems will I have with the existing PHP
code base?
>
I see:
>
Local Master
>
magic_quote s_gpc On On
magic_quote s_runtime Off Off
>
I'm not sure what that means. I think that means that anything
coming in on $_REQUEST is backslashed and I'm thinking that
probably won't play well with PDO. If I turn that off what kind of
failure could I see in the existing code? Is that only a problem in
that single quotes will be backslashed in the data? Or can I have
runtime crashes?
>
Jeff
>

The change from php4 to php5 probably won't be too painful.
Virtually everything I've written for php4 runs fine on php5.

The magic_quotes_gp c may be another problem, however. You should
have it off (it will be removed in php6 because it never really
worked). If you've been depending on it being on, you'll have some
code to change.
This is the code I wrote, if I need to deal with the possibility of
magic_quotes_ gpc being enabled. I don't know if this is the best,
most efficient approach, though:

<?php
if ( get_magic_quote s_gpc() ) {
$lambda = create_function ('&$str,$key',' $str=stripslash es($str);');
array_walk_recu rsive($_GET, $lambda);
array_walk_recu rsive($_POST, $lambda);
array_walk_recu rsive($_COOKIE, $lambda);
}
?>

Thanks, I've added that to my php code snippets library.

I think it's more likely that I may need to turn on magic_quotes_gp c
in some existing code. No telling what may be there until someone
complains! I'm not particularly wanting to spider 60 domains and check
the code, there's enough I don't get paid for now!

I think PHP suffers from the same problem that ASP does. It's
perfectly easy for any idiot to write the most horrible unmaintainable
crap!

I have programmed in Fortran, PL/1, C, Java, Basic, Pascal, Cobol, PHP,
VB, DCL, sh, csh, etc. and there isn't a language that I have seen that
can prevent "any idiot to write the most horrible unmaintainable crap".
But *most* idiots wouldn't attempt to write C or Java or C++. Every
idiot thinks they can write ASP or PHP. They even have Complete Idiots
books for them. At least in PHP you can write well, I'm unconvinced that
is even possible in classic ASP.

Simple only encourages them. This is not a fault per se in the language.

Jeff
Jul 20 '08 #9
Jeff wrote:
sheldonlg wrote:
>Jeff wrote:
>>Curtis wrote:
Jerry Stuckle wrote:
Jeff wrote:
> I'm working on a server that is running PHP4.
>>
> I'd like to upgrade this so I can use the PHP5 code I have already.
>>
> What kind, if any, problems will I have with the existing PHP
>code base?
>>
> I see:
>>
> Local Master
>>
>magic_quot es_gpc On On
>magic_quot es_runtime Off Off
>>
>I'm not sure what that means. I think that means that anything
>coming in on $_REQUEST is backslashed and I'm thinking that
>probably won't play well with PDO. If I turn that off what kind
>of failure could I see in the existing code? Is that only a
>problem in that single quotes will be backslashed in the data? Or
>can I have runtime crashes?
>>
> Jeff
>>
>
The change from php4 to php5 probably won't be too painful.
Virtually everything I've written for php4 runs fine on php5.
>
The magic_quotes_gp c may be another problem, however. You should
have it off (it will be removed in php6 because it never really
worked). If you've been depending on it being on, you'll have some
code to change.
>

This is the code I wrote, if I need to deal with the possibility of
magic_quotes _gpc being enabled. I don't know if this is the best,
most efficient approach, though:

<?php
if ( get_magic_quote s_gpc() ) {
$lambda = create_function ('&$str,$key',' $str=stripslash es($str);');
array_walk_recu rsive($_GET, $lambda);
array_walk_recu rsive($_POST, $lambda);
array_walk_recu rsive($_COOKIE, $lambda);
}
?>

Thanks, I've added that to my php code snippets library.

I think it's more likely that I may need to turn on magic_quotes_gp c
in some existing code. No telling what may be there until someone
complains! I'm not particularly wanting to spider 60 domains and
check the code, there's enough I don't get paid for now!

I think PHP suffers from the same problem that ASP does. It's
perfectly easy for any idiot to write the most horrible
unmaintainabl e crap!

I have programmed in Fortran, PL/1, C, Java, Basic, Pascal, Cobol,
PHP, VB, DCL, sh, csh, etc. and there isn't a language that I have
seen that can prevent "any idiot to write the most horrible
unmaintainab le crap".

But *most* idiots wouldn't attempt to write C or Java or C++. Every
idiot thinks they can write ASP or PHP. They even have Complete Idiots
books for them. At least in PHP you can write well, I'm unconvinced that
is even possible in classic ASP.

Simple only encourages them. This is not a fault per se in the language.

Jeff
Jeff,

I agree. I've programmed in more languages than most - and some you've
probably never even heard of. In the years I've been programming and
teaching, I've seen some people try to write lousy code in other
languages.

For instance, they might try in C - but it isn't long before they have
real problems (i.e. bad pointers, insufficiently large arrays, etc.) and
give up. Even Java, with it's better handling of things, seems to deter
poor programmers.

But PHP and VBScript really do seem to attract poor programmers, and
even encourage them.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jul 20 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2802
by: Tim Tyler | last post by:
I'm sure this is a FAQ - but I could not find a coherent statement of the answer: Some of my clients want PHP4. Other ones want PHP5. Can I run both PHP4 and PHP5 under the same instance of Apache - both on port 80 - using different file extensions to distinguish between them? --
0
2021
by: Dave Pham | last post by:
I just cleaned my comp, and I am trying to re-config my webserver... I am trying to setup apache 2 so it runs both php4 and php5, I also have two instances of mysql running. I know this can be done cos it had work before, but after this incident its not longer... These are my directories for each: Apache: D:\ServerRoot\Apache\Apache2 MySQL1: D:\ServerRoot\mysql1
1
2767
by: dk_sz | last post by:
Is it just me... Or is PHP5 XML very limited? Or am I missing something very obvious? Any way to use PHP4 Dom XML in PHP5? Does anyone know why support for it was dropped? I have following code I need to have replaced: PHP4
4
5434
by: Kevin | last post by:
Hi all, I've got a PHP4 app that I developed which I'm trying to get to run on a PHP5 server. Everything works great, except for one thing. There's a particular routine that creates an original object, then copies it. (The object constructor gets some meta information from the database, so I copy it for performance reasons). The routine then modifies the copies. PHP5 copies by reference by default, so this doesn't work--- I'm not
5
2323
by: sinister | last post by:
I'm starting a database/web interface project, using Linux and postgresql. I've programmed in PHP4 in the past, and for this new project am unsure whether to use PHP4 or PHP5. My main concerns are stability and security. What are the pros/cons/issues for PHP4/PHP5 with apache (either 1.3 or 2)? TIA,
2
2587
by: Stefan Huber | last post by:
Hi I've got a really strange problem, and can't find out why it's not working as intended. in order to use php4 and 5 together on a webserver and the requirement for running as different users, I use suexec and a wrapper script for php files. to make it a bit clearer, i'll post the different snippets: httpd.conf:
12
2308
by: Drazen Gemic | last post by:
How long will PHP4 be supported ? When is PHP4 end of life scheduled ? DG
3
3305
by: xhe | last post by:
I have just upgraded my php version form php4 to php5. and I met this problem, and don't know if you know the solution. My site was written in PHP4, and most parts can be running smoothly in PHP5, only that in old version, I can use $row to access the data in database directly, no need to put double quote around fieldname. BUT in PHP5, this is wrong, I got error message "undefined constant". I know this is because PHP5 see the fieldname...
8
2321
by: FFMG | last post by:
Hi, I am slowly moving my code to php5. But I would like to make it backward compatible in case something bad happens, (and to make sure I understand what the changes are). The way the constructors work seem to have changed quite a bit and I am not getting the same behavior across the versions. // Some simple code/
3
3477
by: jmark | last post by:
I am currently running php 4.4.7 in windows xp and apache 2. If I enter php in command line. I get the following error The application has failed to start because php5ts.dll was not found" I have installed both php5 and php 4.4.7 but I am not running php5 as I have all the entries in httpd.conf related to php5 commented out. I also do not have anything pointing to php5 in my environment path if I type php -i
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.