Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 703d980c580707c382b4e43e25965bc5 > files > 10616

php-manual-pt_BR-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Using the bundled PHP</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Manual do PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Instalação no Mac OS X"
HREF="install.macosx.html"><LINK
REL="PREVIOUS"
TITLE="Instalação no Mac OS X"
HREF="install.macosx.html"><LINK
REL="NEXT"
TITLE="Compilando para o Mac OS X - Versão Servidor"
HREF="install.macosx.server.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual do PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="install.macosx.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Capítulo 5. Instalação no Mac OS X</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="install.macosx.server.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="install.macosx.bundled"
>Using the bundled PHP</A
></H1
><P
>&#13;  PHP has come standard with Macs since OS X version 10.0.0. Enabling PHP 
  with the default web server requires uncommenting a few lines in the 
  Apache configuration file <TT
CLASS="filename"
>httpd.conf</TT
> whereas the 
  <ACRONYM
CLASS="acronym"
>CGI</ACRONYM
> and/or <ACRONYM
CLASS="acronym"
>CLI</ACRONYM
> are enabled by  
  default (easily accessible via the Terminal program).
 </P
><P
>&#13;  Enabling PHP using the instructions below is meant for quickly setting up
  a local development environment.  It's <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>highly recommended</I
></SPAN
> 
  to always upgrade PHP to the newest version. Like most live software, 
  newer versions are created to fix bugs and add features and PHP being is 
  no different.  See the appropriate MAC OS X installation documentation for 
  further details. The following instructions are geared towards a beginner 
  with details provided for getting a default setup to work. All users are 
  encouraged to compile, or install a new packaged version.  
 </P
><P
>&#13;  The standard installation type is using mod_php, and enabling the bundled 
  mod_php on Mac OS X for the Apache web server (the default web server, 
  that is accessible via System Preferences) involves the following steps:
 </P
><P
>&#13;  <P
></P
><OL
TYPE="1"
><LI
><P
>&#13;     Locate and open the Apache configuration file. By default, the location 
     is as follows: <TT
CLASS="filename"
>/etc/httpd/httpd.conf</TT
>
    </P
><P
>&#13;     Using <TT
CLASS="literal"
>Finder</TT
> or <TT
CLASS="literal"
>Spotlight</TT
> to find
     this file may prove difficult as by default it's private and owned by
     the <TT
CLASS="literal"
>root</TT
> user.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
      One way to open this is by using a Unix based text editor in the
      Terminal, for example <TT
CLASS="literal"
>nano</TT
>, and because the 
      file is owned by root we'll use the <TT
CLASS="literal"
>sudo</TT
> command
      to open it (as root) so for example type the following into the 
      <TT
CLASS="literal"
>Terminal</TT
> Application (after, it will prompt for
      a password):
      <TT
CLASS="literal"
>sudo nano /etc/httpd/httpd.conf</TT
>
     </P
><P
>&#13;      Noteworthy nano commands: <TT
CLASS="literal"
>^w</TT
> (search), 
      <TT
CLASS="literal"
>^o</TT
> (save), and <TT
CLASS="literal"
>^x</TT
> (exit) where 
      <TT
CLASS="literal"
>^</TT
> represents the Ctrl key.
     </P
></BLOCKQUOTE
></DIV
></LI
><LI
><P
>&#13;     With a text editor, uncomment the lines (by removing the #) that look 
     similar to the following (these two lines are often not together, 
     locate them both in the file):
     <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
># LoadModule php4_module libexec/httpd/libphp4.so

# AddModule mod_php4.c</PRE
></TD
></TR
></TABLE
>
      Notice the location/path. When building PHP in the future, the above
      files should be replaced or commented out.
    </P
></LI
><LI
><P
>&#13;     Be sure the desired extensions will parse as PHP (examples: .php .html 
     and .inc)
    </P
><P
>&#13;     Due to the following statement already existing in
     <TT
CLASS="filename"
>httpd.conf</TT
> (as of Mac Panther), once PHP is 
     enabled the <TT
CLASS="filename"
>.php</TT
> files will automatically 
     parse as PHP.
     <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>&#60;IfModule mod_php4.c&#62;
    # If php is turned on, we respect .php and .phps files.
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    # Since most users will want index.php to work we
    # also automatically enable index.php
    &#60;IfModule mod_dir.c&#62;
        DirectoryIndex index.html index.php
    &#60;/IfModule&#62;
&#60;/IfModule&#62;</PRE
></TD
></TR
></TABLE
>
    </P
></LI
><LI
><P
>&#13;     Be sure the DirectoryIndex loads the desired default index file
    </P
><P
>&#13;     This is also set in <TT
CLASS="filename"
>httpd.conf</TT
>. Typically 
     <TT
CLASS="filename"
>index.php</TT
> and <TT
CLASS="filename"
>index.html</TT
> are 
     used. By default <TT
CLASS="filename"
>index.php</TT
> is enabled because 
     it's also in the PHP check shown above. Adjust accordingly.
    </P
></LI
><LI
><P
>&#13;     Set the <TT
CLASS="filename"
>php.ini</TT
> location or use the default
    </P
><P
>&#13;     A typical default location on Mac OS X is 
     <TT
CLASS="filename"
>/usr/local/php/php.ini</TT
> and a call to
     <A
HREF="function.phpinfo.html"
><B
CLASS="function"
>phpinfo()</B
></A
> will reveal this information. 
     If a <TT
CLASS="filename"
>php.ini</TT
> is not used, PHP will use all default values.
     See also the related FAQ on 
     <A
HREF="faq.installation.html#faq.installation.phpini"
>finding php.ini</A
>.
    </P
></LI
><LI
><P
>&#13;     Locate or set the <TT
CLASS="literal"
>DocumentRoot</TT
>
    </P
><P
>&#13;     This is the root directory for all the web files. Files in this directory 
     are served from the web server so the PHP files will parse as PHP before
     outputting them to the browser. A typical default path is 
     <TT
CLASS="filename"
>/Library/WebServer/Documents</TT
> but this can be set to
     anything in <TT
CLASS="filename"
>httpd.conf</TT
>.  Alternatively, the default 
     DocumentRoot for individual users is 
     <TT
CLASS="filename"
>/Users/yourusername/Sites</TT
>
    </P
></LI
><LI
><P
>&#13;     Create a <A
HREF="function.phpinfo.html"
><B
CLASS="function"
>phpinfo()</B
></A
> file
    </P
><P
>&#13;     The <A
HREF="function.phpinfo.html"
><B
CLASS="function"
>phpinfo()</B
></A
> function will display information about PHP. 
     Consider creating a file in the DocumentRoot with the following PHP code:
     <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php phpinfo</font><font color="#007700">(); </font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
>
    </P
></LI
><LI
><P
>&#13;     Restart Apache, and load the PHP file created above
    </P
><P
>&#13;     To restart, either execute <TT
CLASS="literal"
>sudo apachectl graceful</TT
> in 
     the shell or stop/start the "Personal Web Server" option in the
     OS X System Preferences. By default, loading local files in the browser 
     will have an <ACRONYM
CLASS="acronym"
>URL</ACRONYM
> like so: 
     <TT
CLASS="filename"
>http://localhost/info.php</TT
> Or using the DocumentRoot 
     in the user directory is another option and would end up looking like: 
     <TT
CLASS="filename"
>http://localhost/~yourusername/info.php</TT
>
    </P
></LI
></OL
>
 </P
><P
>&#13;  The <ACRONYM
CLASS="acronym"
>CLI</ACRONYM
> (or <ACRONYM
CLASS="acronym"
>CGI</ACRONYM
> in older versions) is 
  appropriately named <TT
CLASS="filename"
>php</TT
> and likely exists as  
  <TT
CLASS="filename"
>/usr/bin/php</TT
>. Open up the terminal, read the
  <A
HREF="features.commandline.html"
>command line section</A
> of the PHP 
  manual, and execute <TT
CLASS="literal"
>php -v</TT
> to check the PHP version of 
  this PHP binary. A call to <A
HREF="function.phpinfo.html"
><B
CLASS="function"
>phpinfo()</B
></A
> will also reveal
  this information.
 </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="install.macosx.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Principal</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="install.macosx.server.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Instalação no Mac OS X</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="install.macosx.html"
ACCESSKEY="U"
>Acima</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Compilando para o Mac OS X - Versão Servidor</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>