pavement

PHP, Installing

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
(PHP 5 Installing)
m (Reverted edits by 201.70.110.9 (Talk); changed back to last version by Jimbo)
 
(31 intermediate revisions by 21 users not shown)
Line 1: Line 1:
 
Installing PHP with all the proper extensions can be a little tricky.  The easiest way to do it (assuming you've already got your preferred version of Apache up and running) is as follows... first, head to /usr/ports/www/mod_php4 and '''make install clean'''.  There isn't too much to be aware of here, except to make sure you either do or don't check "use Apache2" depending on whether your version of Apache is 1.x or 2.x.
 
Installing PHP with all the proper extensions can be a little tricky.  The easiest way to do it (assuming you've already got your preferred version of Apache up and running) is as follows... first, head to /usr/ports/www/mod_php4 and '''make install clean'''.  There isn't too much to be aware of here, except to make sure you either do or don't check "use Apache2" depending on whether your version of Apache is 1.x or 2.x.
 
Next, head to /usr/ports/lang/php4-extensions and '''make install''' - this time, though, you might want to leave the "clean" off.  This one's lots more fun - this is where you get to pick and choose capabilities for everything from MySQL (or other SQL server variants) support, PDF library support, image manipulation... you name it.  Pick everything you need, but try not to pick anything you DON'T need - remember, "just what you need and no more" is always better (and more secure) than "everything but the kitchen sink".  You can always come back later and add more extensions if you need to - all you have to do to change which extensions you're building is type '''make config''' (a trick that works in any of the ports that have ncurses-style text menus to configure them).
 
 
Depending on how many extensions you selected, this one can take a LONG time to compile.  You may also run into problems where it bombs out due to old versions of some of the dependencies for some of the extensions being installed - for example, when I just now rebuilt the extensions on this webserver, I encountered the following problem:
 
 
===>  Installing for pdflib-6.0.0p1
 
===>  Generating temporary packing list
 
===>  Checking if print/pdflib already installed
 
===>  an older version of print/pdflib is already installed
 
      You may wish to ``make deinstall'' and install this port again
 
      by ``make reinstall'' to upgrade it properly.
 
      If you really wish to overwrite the old port of print/pdflib
 
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
 
      in your environment or the "make install" command line.
 
*** Error code 1
 
 
Stop in /usr/ports/print/pdflib.
 
  *** Error code 1
 
 
Stop in /usr/ports/lang/php4-extensions.
 
 
This was the fix:
 
 
freebsdwiki# '''cd /usr/ports/print/pdflib'''
 
freebsdwiki# '''make deinstall'''
 
freebsdwiki# '''cd /usr/ports/lang/php4-extensions'''
 
freebsdwiki# '''make install'''
 
 
... and off it happily trundled again, finishing my aborted installation from whence it had left off.  Situations like this are why, for complex ports like this one, it's well-advised NOT to issue a '''make install clean''' all in one fell swoop, but instead to '''make install''' first, and wait to '''make clean''' until everything is satisfactorily built and installed to specification.  (If you're really feeling paranoid and/or are working on a really critical high-traffic server, it's better yet to start with '''make''', then donHTTP/1.0 200 OK
 
Date: Mon, 08 Sep 2008 10:12:23 GMT
 
Server: Apache/2.2.3 (FreeBSD) mod_ssl/2.2.3 OpenSSL/0.9.7e-p1 DAV/2 PHP/5.2.6 with Suhosin-Patch
 
X-Powered-By: PHP/5.2.6
 
Set-Cookie: bsdwiki_session=g4h7si5n9o7l9b2bh93jda0q23; path=/
 
Content-Language: en
 
Vary: Accept-Encoding,Cookie
 
Expires: Thu, 01 Jan 1970 00:00:00 GMT
 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
 
Pragma: no-cache
 
Content-Type: text/html; charset=utf-8
 
X-Cache: MISS from proxy.igloofun.com
 
X-Cache-Lookup: MISS from proxy.igloofun.com:3128
 
Via: 1.0 proxy.igloofun.com:3128 (squid/2.6.STABLE10)
 
Proxy-Connection: close
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
 
<head>
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
<meta name="robots" content="noindex,nofollow" />
 
<meta name="keywords" content="PHP, Installing,PHP, Installing,PHP, Installing,Copyrights,PHP, Installing,PHP, Installing,PHP, Installing" />
 
<link rel="shortcut icon" href="/favicon.ico" />
 
<title>Edit conflict: PHP, Installing - Preview - FreeBSDwiki</title>
 
<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "/skins/monobook/main.css?9"; /*]]>*/</style>
 
<link rel="stylesheet" type="text/css" media="print" href="/skins/common/commonPrint.css" />
 
<!--[if lt IE 5.5000]><style type="text/css">@import "/skins/monobook/IE50Fixes.css";</style><![endif]-->
 
<!--[if IE 5.5000]><style type="text/css">@import "/skins/monobook/IE55Fixes.css";</style><![endif]-->
 
<!--[if IE 6]><style type="text/css">@import "/skins/monobook/IE60Fixes.css";</style><![endif]-->
 
<!--[if IE 7]><style type="text/css">@import "/skins/monobook/IE70Fixes.css?1";</style><![endif]-->
 
<!--[if lt IE 7]><script type="text/javascript" src="/skins/common/IEFixes.js"></script>
 
<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
 
<script type="text/javascript">var skin = 'monobook';var stylepath = '/skins';</script>
 
<script type="text/javascript" src="/skins/common/wikibits.js?1"><!-- wikibits js --></script>
 
<script type="text/javascript" src="/index.php?title=-&action=raw&gen=js"><!-- site js --></script>
 
<style type="text/css">/*<![CDATA[*/
 
@import "/index.php?title=MediaWiki:Common.css&action=raw&ctype=text/css&smaxage=18000";
 
@import "/index.php?title=MediaWiki:Monobook.css&action=raw&ctype=text/css&smaxage=18000";
 
@import "/index.php?title=-&action=raw&gen=css&maxage=18000";
 
/*]]>*/</style>
 
<!-- Head Scripts -->
 
</head>
 
<body  class="ns-0 ltr">
 
<div id="globalWrapper">
 
<div id="column-content">
 
<div id="content">
 
<a name="top" id="top"></a>
 
<h1 class="firstHeading">Edit conflict: PHP, Installing</h1>
 
<div id="bodyContent">
 
<h3 id="siteSub">From FreeBSDwiki</h3>
 
<div id="contentSub"></div>
 
<div id="jump-to-nav">Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a></div> <!-- start content -->
 
�<p><font size="5"><font color="red">NOTICE:</font> this version of MediaWiki uses the <a href="http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html">nofollow tag</a> on all editable pages.</font><p>�<p><h2>This means that your spam <a href="http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html">will NOT result in any improvement in search engine rankings</a> even if you succeed in posting it.<p>Please desist, this isn't doing you any more good than it does the users of this wiki.</h2><p>�<p>�<p><p>Someone else has changed this page since you started editing it.
 
The upper text area contains the page text as it currently exists.
 
Your changes are shown in the lower text area.
 
You will have to merge your changes into the existing text.
 
<b>Only</b> the text in the upper text area will be saved when you
 
press "Save page".<br />
 
</p><p><b>Warning:</b> You are not logged in. Your IP address will be recorded in this page's edit history.
 
</p><div id="wikiPreview"></div><div id='toolbar'>
 
<script type='text/javascript'>
 
/*<![CDATA[*/
 
addButton('/skins/common/images/button_bold.png','Bold text','\'\'\'','\'\'\'','Bold text');
 
addButton('/skins/common/images/button_italic.png','Italic text','\'\'','\'\'','Italic text');
 
addButton('/skins/common/images/button_link.png','Internal link','[[',']]','Link title');
 
addButton('/skins/common/images/button_extlink.png','External link (remember http:// prefix)','[',']','http://www.example.com link title');
 
addButton('/skins/common/images/button_headline.png','Level 2 headline','\n== ',' ==\n','Headline text');
 
addButton('/skins/common/images/button_image.png','Embedded image','[[Image:',']]','Example.jpg');
 
addButton('/skins/common/images/button_media.png','Media file link','[[Media:',']]','Example.ogg');
 
addButton('/skins/common/images/button_math.png','Mathematical formula (LaTeX)','<math>','<\/math>','Insert formula here');
 
addButton('/skins/common/images/button_nowiki.png','Ignore wiki formatting','<nowiki>','<\/nowiki>','Insert non-formatted text here');
 
addButton('/skins/common/images/button_sig.png','Your signature with timestamp','--~~~~','','');
 
addButton('/skins/common/images/button_hr.png','Horizontal line (use sparingly)','\n----\n','','');
 
/*]]>*/
 
</script>
 
</div>
 
<form id="editform" name="editform" method="post" action="/index.php?title=PHP%2C_Installing&action=submit" enctype="multipart/form-data">
 
<input type='hidden' value="" name="wpSection" />
 
<input type='hidden' value="20080908101137" name="wpStarttime" />
 
 
<input type='hidden' value="20080821010517" name="wpEdittime" />
 
 
<input type='hidden' value="" name="wpScrolltop" id="wpScrolltop" />
 
 
 
<textarea tabindex='1' accesskey="," name="wpTextbox1" id="wpTextbox1" rows='25'
 
cols='80' >Installing PHP with all the proper extensions can be a little tricky.  The easiest way to do it (assuming you've already got your preferred version of Apache up and running) is as follows... first, head to /usr/ports/www/mod_php4 and '''make install clean'''.  There isn't too much to be aware of here, except to make sure you either do or don't check "use Apache2" depending on whether your version of Apache is 1.x or 2.x.
 
  
 
Next, head to /usr/ports/lang/php4-extensions and '''make install''' - this time, though, you might want to leave the "clean" off.  This one's lots more fun - this is where you get to pick and choose capabilities for everything from MySQL (or other SQL server variants) support, PDF library support, image manipulation... you name it.  Pick everything you need, but try not to pick anything you DON'T need - remember, "just what you need and no more" is always better (and more secure) than "everything but the kitchen sink".  You can always come back later and add more extensions if you need to - all you have to do to change which extensions you're building is type '''make config''' (a trick that works in any of the ports that have ncurses-style text menus to configure them).
 
Next, head to /usr/ports/lang/php4-extensions and '''make install''' - this time, though, you might want to leave the "clean" off.  This one's lots more fun - this is where you get to pick and choose capabilities for everything from MySQL (or other SQL server variants) support, PDF library support, image manipulation... you name it.  Pick everything you need, but try not to pick anything you DON'T need - remember, "just what you need and no more" is always better (and more secure) than "everything but the kitchen sink".  You can always come back later and add more extensions if you need to - all you have to do to change which extensions you're building is type '''make config''' (a trick that works in any of the ports that have ncurses-style text menus to configure them).

Latest revision as of 09:29, 10 July 2009

Installing PHP with all the proper extensions can be a little tricky. The easiest way to do it (assuming you've already got your preferred version of Apache up and running) is as follows... first, head to /usr/ports/www/mod_php4 and make install clean. There isn't too much to be aware of here, except to make sure you either do or don't check "use Apache2" depending on whether your version of Apache is 1.x or 2.x.

Next, head to /usr/ports/lang/php4-extensions and make install - this time, though, you might want to leave the "clean" off. This one's lots more fun - this is where you get to pick and choose capabilities for everything from MySQL (or other SQL server variants) support, PDF library support, image manipulation... you name it. Pick everything you need, but try not to pick anything you DON'T need - remember, "just what you need and no more" is always better (and more secure) than "everything but the kitchen sink". You can always come back later and add more extensions if you need to - all you have to do to change which extensions you're building is type make config (a trick that works in any of the ports that have ncurses-style text menus to configure them).

Depending on how many extensions you selected, this one can take a LONG time to compile. You may also run into problems where it bombs out due to old versions of some of the dependencies for some of the extensions being installed - for example, when I just now rebuilt the extensions on this webserver, I encountered the following problem:

===>  Installing for pdflib-6.0.0p1
===>   Generating temporary packing list
===>  Checking if print/pdflib already installed
===>   an older version of print/pdflib is already installed
      You may wish to ``make deinstall and install this port again
      by ``make reinstall to upgrade it properly.
      If you really wish to overwrite the old port of print/pdflib
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1 

Stop in /usr/ports/print/pdflib.
 *** Error code 1

Stop in /usr/ports/lang/php4-extensions.

This was the fix:

freebsdwiki# cd /usr/ports/print/pdflib
freebsdwiki# make deinstall
freebsdwiki# cd /usr/ports/lang/php4-extensions
freebsdwiki# make install

... and off it happily trundled again, finishing my aborted installation from whence it had left off. Situations like this are why, for complex ports like this one, it's well-advised NOT to issue a make install clean all in one fell swoop, but instead to make install first, and wait to make clean until everything is satisfactorily built and installed to specification. (If you're really feeling paranoid and/or are working on a really critical high-traffic server, it's better yet to start with make, then don't make install until you've already done the compilation and everything looks good, and THEN make clean to reclaim the space taken up by the work directories!)

In this case, if I had issued make install clean all in one step, I would have lost close to an hour's worth of compilation time when the process bombed out due to the older version of pdflib being in place, and would have had to begin recompiling all the extensions all over again when I returned to the php4-extensions port after removing the old pdflib.

You may even, if you've got the hard drive space to spare, wish to NOT issue a make clean at all on this port - it'll save you a lot of time if you ever need to install new extensions, since the work will already be done on any of the extensions that haven't been updated since the last time.

[edit] PHP 5 Installing

Install from ports

/usr/ports/lang/php5

Select Apache when configuring

# make config

Then install the port

# make install clean
# cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini

Add the following lines to /usr/local/etc/apache2/httpd.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Change the following line in httpd.conf from

DirectoryIndex index.html 

To:

DirectoryIndex index.html index.php

Test with <? phpinfo(); ?>

# echo "<? phpinfo(); ?>" >> /usr/local/www/data/test.php

Restart apache.

Personal tools