mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
These all should be informal examples
<informalexample> doesn't require title and therefore unclutters Example Index git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@341083 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
24e4bc70a6
commit
445962cfde
4 changed files with 78 additions and 78 deletions
|
@ -41,27 +41,27 @@
|
|||
<para>Obtain the Apache HTTP server from the location listed above,
|
||||
and unpack it:</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
gzip -d httpd-2_x_NN.tar.gz
|
||||
tar -xf httpd-2_x_NN.tar
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>Likewise, obtain and unpack the PHP source:</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
gunzip php-NN.tar.gz
|
||||
tar -xf php-NN.tar
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -70,7 +70,7 @@ tar -xf php-NN.tar
|
|||
more details on building Apache.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
cd httpd-2_x_NN
|
||||
|
@ -79,7 +79,7 @@ make
|
|||
make install
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -89,23 +89,23 @@ make install
|
|||
To test the installation use your normal procedure for starting
|
||||
the Apache server, e.g.:
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/usr/local/apache2/bin/apachectl start
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
and stop the server to go on with the configuration for PHP:
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/usr/local/apache2/bin/apachectl stop
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
|
@ -124,7 +124,7 @@ match your path for apxs, but if you installed Apache some other way, you'll
|
|||
need to adjust the path to apxs accordingly. Note that some distros may rename
|
||||
apxs to apxs2.
|
||||
</para>
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
cd ../php-NN
|
||||
|
@ -133,7 +133,7 @@ make
|
|||
make install
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
If you decide to change your configure options after installation,
|
||||
|
@ -155,13 +155,13 @@ make install
|
|||
Setup your php.ini
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
cp php.ini-development /usr/local/lib/php.ini
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
You may edit your .ini file to set PHP options. If you prefer having
|
||||
|
@ -185,7 +185,7 @@ cp php.ini-development /usr/local/lib/php.ini
|
|||
added this for you, but be sure to check.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<para>
|
||||
For PHP 7:
|
||||
</para>
|
||||
|
@ -194,9 +194,9 @@ cp php.ini-development /usr/local/lib/php.ini
|
|||
LoadModule php7_module modules/libphp7.so
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<para>
|
||||
For PHP 5:
|
||||
</para>
|
||||
|
@ -205,7 +205,7 @@ LoadModule php7_module modules/libphp7.so
|
|||
LoadModule php5_module modules/libphp5.so
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
</listitem>
|
||||
|
||||
|
@ -221,7 +221,7 @@ LoadModule php5_module modules/libphp5.so
|
|||
</para>
|
||||
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<programlisting role="apache-conf">
|
||||
<![CDATA[
|
||||
<FilesMatch \.php$>
|
||||
|
@ -229,14 +229,14 @@ LoadModule php5_module modules/libphp5.so
|
|||
</FilesMatch>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and
|
||||
.phtml files to be executed as PHP, but nothing else, we'd use this:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<programlisting role="apache-conf">
|
||||
<![CDATA[
|
||||
<FilesMatch "\.ph(p[2-6]?|tml)$">
|
||||
|
@ -244,14 +244,14 @@ Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and
|
|||
</FilesMatch>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
And to allow .phps files to be handled by the php source filter, and
|
||||
displayed as syntax-highlighted source code, use this:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<programlisting role="apache-conf">
|
||||
<![CDATA[
|
||||
<FilesMatch "\.phps$">
|
||||
|
@ -259,7 +259,7 @@ Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and
|
|||
</FilesMatch>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
mod_rewrite may be used To allow any arbitrary .php file to be displayed
|
||||
|
@ -267,14 +267,14 @@ Or, if we wanted to allow .php, .php2, .php3, .php4, .php5, .php6, and
|
|||
to a .phps file:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<programlisting role="apache-conf">
|
||||
<![CDATA[
|
||||
RewriteEngine On
|
||||
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
The php source filter should not be enabled on production systems, where
|
||||
|
@ -289,23 +289,23 @@ RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]
|
|||
Use your normal procedure for starting the Apache server, e.g.:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/usr/local/apache2/bin/apachectl start
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>OR</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
service httpd restart
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
@ -324,13 +324,13 @@ service httpd restart
|
|||
adding the following option to the argument passed to ./configure, in
|
||||
step 3 above:
|
||||
</para>
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
--with-mpm=worker
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
<para>
|
||||
This should not be undertaken without being aware of the consequences of
|
||||
this decision, and having at least a fair understanding of
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
Obtain and unpack the php source:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.litespeed.extract.php">
|
||||
<informalexample xml:id="install.unix.litespeed.extract.php">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
mkdir /home/php
|
||||
|
@ -59,7 +59,7 @@ tar -zxvf php-x.x.x.tar.gz
|
|||
cd php-x.x.x
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -70,7 +70,7 @@ cd php-x.x.x
|
|||
LiteSpeed Web Server:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.litespeed.build.php">
|
||||
<informalexample xml:id="install.unix.litespeed.build.php">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
./configure ... '--with-litespeed'
|
||||
|
@ -78,7 +78,7 @@ make
|
|||
sudo make install
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -91,20 +91,20 @@ sudo make install
|
|||
is to run the following code:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
cd /usr/local/lsws/fcgi-bin/
|
||||
./lsphp5 -v
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
This should return information about the new PHP build:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
PHP 5.6.17 (litespeed) (built: Mar 22 2016 11:34:19)
|
||||
|
@ -112,7 +112,7 @@ Copyright (c) 1997-2014 The PHP Group
|
|||
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Notice the <literal>litespeed</literal> in parenthesis. This means that the PHP binary has been
|
||||
|
@ -154,61 +154,61 @@ Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
|
|||
Have LSPHP bind to port 3000 on all IPv4 and IPv6 addresses:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/path/to/lsphp -b [::]:3000
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Have LSPHP bind to port 3000 on all IPv4 addresses:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/path/to/lsphp -b *:3000
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Have LSPHP bind to address 192.168.0.2:3000:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/path/to/lsphp -b 192.168.0.2:3000
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Have LSPHP accept requests on Unix domain socket <literal>/tmp/lsphp_manual.sock</literal>:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/path/to/lsphp -b /tmp/lsphp_manual.sock
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Environment variables can be added before the LSPHP executable:
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<informalexample>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
PHP_LSAPI_MAX_REQUESTS=500 PHP_LSAPI_CHILDREN=35 /path/to/lsphp -b IP_address:port
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Currently LiteSpeed PHP can be used with LiteSpeed Web Server,
|
||||
|
|
|
@ -44,13 +44,13 @@
|
|||
Obtain and unpack the PHP source:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.extract.php">
|
||||
<informalexample xml:id="install.unix.nginx.extract.php">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
tar zxf php-x.x.x
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -61,7 +61,7 @@ tar zxf php-x.x.x
|
|||
we'll do a simple configure with PHP-FPM and MySQL support.
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.build.php">
|
||||
<informalexample xml:id="install.unix.nginx.build.php">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
cd ../php-x.x.x
|
||||
|
@ -70,7 +70,7 @@ make
|
|||
sudo make install
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -78,7 +78,7 @@ sudo make install
|
|||
Obtain and move configuration files to their correct locations
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.configure.php">
|
||||
<informalexample xml:id="install.unix.nginx.configure.php">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
cp php.ini-development /usr/local/php/php.ini
|
||||
|
@ -86,7 +86,7 @@ cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
|
|||
cp sapi/fpm/php-fpm /usr/local/bin
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -104,25 +104,25 @@ cp sapi/fpm/php-fpm /usr/local/bin
|
|||
Load up php.ini:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.configure.ini">
|
||||
<informalexample xml:id="install.unix.nginx.configure.ini">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
vim /usr/local/php/php.ini
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Locate <literal>cgi.fix_pathinfo=</literal> and modify it as follows:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.configure.pathinfo">
|
||||
<informalexample xml:id="install.unix.nginx.configure.pathinfo">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
cgi.fix_pathinfo=0
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -131,19 +131,19 @@ cgi.fix_pathinfo=0
|
|||
www-data and the group www-data before we can start the service:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.modify.phpfpm">
|
||||
<informalexample xml:id="install.unix.nginx.modify.phpfpm">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
vim /usr/local/etc/php-fpm.conf
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Find and modify the following:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.modify.phpfpm.usergroup">
|
||||
<informalexample xml:id="install.unix.nginx.modify.phpfpm.usergroup">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
; Unix user/group of processes
|
||||
|
@ -153,19 +153,19 @@ user = www-data
|
|||
group = www-data
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
The php-fpm service can now be started:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.start.phpfpm">
|
||||
<informalexample xml:id="install.unix.nginx.start.phpfpm">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
/usr/local/bin/php-fpm
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
This guide will not configure php-fpm any further, if you are interested
|
||||
|
@ -178,20 +178,20 @@ group = www-data
|
|||
Nginx must now be configured to support the processing of PHP applications:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.configure.nginx">
|
||||
<informalexample xml:id="install.unix.nginx.configure.nginx">
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
vim /usr/local/nginx/conf/nginx.conf
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Modify the default location block to be aware it must attempt
|
||||
to serve .php files:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.configure.nginx.location">
|
||||
<informalexample xml:id="install.unix.nginx.configure.nginx.location">
|
||||
<programlisting role="nginx-conf">
|
||||
<![CDATA[
|
||||
location / {
|
||||
|
@ -200,7 +200,7 @@ location / {
|
|||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
The next step is to ensure that .php files are passed to the
|
||||
|
@ -208,7 +208,7 @@ location / {
|
|||
enter the following:
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.configure.nginx.php">
|
||||
<informalexample xml:id="install.unix.nginx.configure.nginx.php">
|
||||
<programlisting role="nginx-conf">
|
||||
<![CDATA[
|
||||
location ~* \.php$ {
|
||||
|
@ -220,20 +220,20 @@ location ~* \.php$ {
|
|||
}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Restart Nginx.
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.restart.nginx">
|
||||
<informalexample xml:id="install.unix.nginx.restart.nginx">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
sudo /usr/local/nginx/sbin/nginx -s stop
|
||||
sudo /usr/local/nginx/sbin/nginx
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -241,14 +241,14 @@ sudo /usr/local/nginx/sbin/nginx
|
|||
Create a test file
|
||||
</para>
|
||||
|
||||
<example xml:id="install.unix.nginx.test.nginx.php">
|
||||
<informalexample xml:id="install.unix.nginx.test.nginx.php">
|
||||
<screen>
|
||||
<![CDATA[
|
||||
rm /usr/local/nginx/html/index.html
|
||||
echo "<?php phpinfo(); ?>" >> /usr/local/nginx/html/index.php
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</informalexample>
|
||||
|
||||
<para>
|
||||
Now navigate to http://localhost. The phpinfo() should now be shown.
|
||||
|
|
|
@ -76,7 +76,7 @@ echo "Last statement";
|
|||
Everything outside of a pair of opening and closing tags is ignored by the
|
||||
PHP parser which allows PHP files to have mixed content. This allows PHP
|
||||
to be embedded in HTML documents, for example to create templates.
|
||||
<example>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<p>This is going to be ignored by PHP and displayed by the browser.</p>
|
||||
|
@ -84,7 +84,7 @@ echo "Last statement";
|
|||
<p>This will also be ignored by PHP and displayed by the browser.</p>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</informalexample>
|
||||
This works as expected, because when the PHP interpreter hits the ?> closing
|
||||
tags, it simply starts outputting whatever it finds (except for an
|
||||
immediately following newline - see
|
||||
|
|
Loading…
Reference in a new issue