Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Update to PHP version 4.2 UNIX
Leave it to Mark Liyanage to keep us up to date with all that "just won't compile on OS X" software. This time - he's got the latest PHP 4.2.0 ready to go for us, either on his site, or through a simple shell script.

Read the rest of the article if you'd like to use the shell script update method...

If you just want to install the module from his site, you can run this shell script:
#!/bin/sh

echo "============================================"
echo " Installing PHP 4.2.0"
echo "============================================"
dir=$HOME/Src
printf "Download the source to what directory [$dir]? "
read dir
: ${dir:=$HOME/Src}
echo $dir
cd $dir
echo "Downloading source to " $dir
curl -O http://www2.entropy.ch/download/libphp4.so.gz
echo "Decompressing source"
gunzip libphp4.so.gz
echo "Installing modules"
sudo apxs -i -a -n php4 libphp4.so
echo "Restarting Apache"
sudo apachectl graceful
echo "============================================"
echo " Install Complete"
echo "============================================"
Copy and paste this code into a text file, save as php4.2.0Install.sh with unix line endings, chmod 755 the text file, and run from the terminal:
./php4.2.0Install.sh
You can test the install by creating a text file with this text inside:
<?php phpinfo(); ?>
Save it as phpinfo.php in your web directory and go to http://localhost/phpinfo.php. You should see the new install of PHP 4.2.0.

FYI - Mark's module has been built with the following configuration:
'./configure' '--disable-cli' '--with-apxs' '--with-mysql' '--with-pgsql' '--with-gd=/usr/local' '--with-png-dir=/usr/local' '--with-zlib-dir=/usr' '--with-jpeg-dir=/usr/local' '--with-freetype-dir=/usr/local' '--with-t1lib=/usr/local' '--enable-trans-sid' '--enable-exif' '--with-xml' '--enable-wddx' '--with-curl=/usr/local' '--with-pdflib=/usr/local' '--enable-ftp' '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-ldap' '--enable-xslt' '--with-xslt-sablot=/usr/local' '--with-imap=../imap-2001a' '--enable-dbx' '--enable-dbase'
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[4,001 views]  

Update to PHP version 4.2 | 11 comments | Create New Account
Click here to return to the 'Update to PHP version 4.2' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Upgrade
Authored by: bluehz on Apr 30, '02 07:31:37AM

Marc pointed out that my shell script was for upgrade only - so you might want to stick to the manual method listed on his page if you are installing for the first time.



[ Reply to This | # ]
It broke my web apps
Authored by: carter on Apr 30, '02 09:30:56AM

I have used Marc's installations of PHP and Mysql in the past and they have worked flawlessly. Yesterday, I upgraded to PHP 4.2.0 using his method on three computers. All of my scripts broke! Now....I am a novice and don't know why this was but it happened. I was able to downgrade, thankfully!
I will try again on a test computer soon. Any thoughts?



[ Reply to This | # ]
PHP 4.2 is different
Authored by: Paul W. Brown on Apr 30, '02 10:08:53AM

The reason why your webapps were "broken" is b/c PHP 4.2 is a whole lot different. The release notes at PHP.net make the point of clairifying that PHP 4.2 uses a differnt syntax - especially regarding varibles, for security reasons. I would go ahead and upgrade and then "patch" your work, if I were you.



[ Reply to This | # ]
PHP 4.2 is different
Authored by: carter on Apr 30, '02 02:24:20PM

Yes, I guessed that it was different....but thanks for your note. I intend to try it on a test system and redo my previous work. I look forward to the chance to learn more about all this.



[ Reply to This | # ]
It broke my web apps
Authored by: deleted_user2 on Apr 30, '02 11:34:35PM
In PHP 4.2.0 global variables are accessed very differently. In previous versions, if you passed in a GET variable to a script it was automatically available everywhere in your script, most old PHP is written based on this assumption. This is no longer the default behavior. One way to fix most of the problems with the new variable structure is to just turn the old way back on. Although you won't have the new added security from PHP 4.2.0, it can offer you a transitional phase while you update your code. To make the old global variable structure work again you just edit your php.ini file in /usr/local/lib (create it if it doesn't exist) and change or add the line: register_globals=on This gives you a chance to change all your $random_get_var to $_GET["random_get_var"] (or just pop something this at the beginning of your code: $random_get_var = $_GET["random_get_var"];). Hope that helps Jeremy Gustie http://www.gustie.com:1313/

[ Reply to This | # ]
It broke my web apps
Authored by: carter on May 01, '02 08:49:58AM

Thank you for this information. I had suspected that my problem was centered around this change (globals) but with my limited knowledge, I was not sure. I also appreciate your help with the temporary fix as well as the recoding help.
Many, many thanks!



[ Reply to This | # ]
It broke my web apps
Authored by: wnixon on Jun 07, '02 05:34:34PM

Regarding, creating the php.ini file. Is there anything else that would need to go into this file other than the one line regarding globals? Will it affect the configuration of php other than the globals?

Thanks, Walt



[ Reply to This | # ]
It broke my web apps
Authored by: wnixon on Jun 20, '02 11:20:12PM

Regarding, creating the php.ini file (which I don't have now). Is there anything else that would need to go into this file other than the one line regarding globals? Will it affect the configuration of php other than the globals?

Thanks, Walt



[ Reply to This | # ]
apsx error
Authored by: Jadey on Apr 30, '02 09:53:49PM

I can't get his PHP instructions to work. I get this error:

cannot open /usr/build/config_vars.mk: No such file or directory at /usr/sbin/apxs line 248.

How can I fix this?



[ Reply to This | # ]
library is garbled
Authored by: latompa on May 05, '02 08:47:38PM

I followed the instructions, and everything worked until
apachectl start

I get a:
libphp4.so is garbled - perhaps this is not an Apache module DSO?

How can I get around this?
[apache-1.3.24]

/Thomas



[ Reply to This | # ]
library is garbled
Authored by: nhyde on Jun 06, '02 01:00:49AM

Yeah, I just got that one too. If you look at the libphp4.so file you download, it's actually an html 404 message. I'd say to email Mark and let him know.

Nathan



[ Reply to This | # ]