mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Fix <programlisting> formatting in MongoDB docs
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@334826 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
ad82d24105
commit
565e478d69
10 changed files with 23 additions and 47 deletions
|
@ -44,16 +44,14 @@
|
|||
<link xlink:href="&url.mongodb.github;">Github</link>.
|
||||
Go to Github and click the "download" button. Then run:
|
||||
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
|
||||
$ tar zxvf mongodb-mongodb-php-driver-<commit_id>.tar.gz
|
||||
$ cd mongodb-mongodb-php-driver-<commit_id>
|
||||
$ phpize
|
||||
$ ./configure
|
||||
$ make all
|
||||
$ sudo make install
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
@ -67,23 +65,19 @@ $ sudo make install
|
|||
Make sure the <emphasis>extension_dir</emphasis> variable is pointing to
|
||||
the directory containing <emphasis>mongo.so</emphasis>. The build will display where
|
||||
it is installing the PHP driver with output that looks something like:
|
||||
<programlisting>
|
||||
<programlisting role="txt">
|
||||
<![CDATA[
|
||||
|
||||
Installing '/usr/lib/php/extensions/no-debug-non-zts-20060613/mongo.so'
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
Make sure that it is the same as the PHP extension directory by runnning:
|
||||
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
|
||||
$ php -i | grep extension_dir
|
||||
extension_dir => /usr/lib/php/extensions/no-debug-non-zts-20060613 =>
|
||||
/usr/lib/php/extensions/no-debug-non-zts-20060613
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
|
@ -95,11 +89,9 @@ $ php -i | grep extension_dir
|
|||
<para>
|
||||
To load the extension on PHP startup, add a line:
|
||||
|
||||
<programlisting>
|
||||
<programlisting role="ini">
|
||||
<![CDATA[
|
||||
|
||||
extension=mongo.so
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
|
@ -112,11 +104,9 @@ extension=mongo.so
|
|||
|
||||
<para>
|
||||
Run:
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
|
||||
$ sudo pecl install mongo
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
@ -128,11 +118,9 @@ $ sudo pecl install mongo
|
|||
|
||||
<para>
|
||||
Add the following line to your php.ini file:
|
||||
<programlisting>
|
||||
<programlisting role="ini">
|
||||
<![CDATA[
|
||||
|
||||
extension=mongo.so
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
@ -156,11 +144,9 @@ extension=mongo.so
|
|||
|
||||
<para>
|
||||
Add the following line to your php.ini file:
|
||||
<programlisting>
|
||||
<programlisting role="ini">
|
||||
<![CDATA[
|
||||
|
||||
extension=php_mongo.dll
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
@ -179,20 +165,16 @@ extension=php_mongo.dll
|
|||
In most cases installing from pecl is the easiest way:
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
|
||||
$ sudo pecl install mongo
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
If you are using XAMPP, you may be able to compile the driver with the
|
||||
following command:
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
|
||||
sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongo
|
||||
|
||||
$ sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongo
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
@ -205,11 +187,9 @@ sudo /Applications/XAMPP/xamppfiles/bin/pecl install mongo
|
|||
Gentoo has a package for the PHP PECL driver called dev-php/pecl-mongo, which can be
|
||||
installed with:
|
||||
</para>
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
|
||||
$ sudo emerge -va dev-php/pecl-mongo
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
|
@ -217,16 +197,14 @@ $ sudo emerge -va dev-php/pecl-mongo
|
|||
If you use PECL, you may get an error that libtool is the wrong version.
|
||||
Compiling from source you'll need to run aclocal and autoconf.
|
||||
</para>
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
|
||||
$ phpize
|
||||
$ aclocal
|
||||
$ autoconf
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
</section>
|
||||
|
@ -240,7 +218,7 @@ $ sudo make install
|
|||
network connections, meaning that the driver will get "Permission denied"
|
||||
errors when it tries to connect to the database. If you run into this, try
|
||||
running:
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
$ /usr/sbin/setsebool -P httpd_can_network_connect 1
|
||||
]]>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<para>
|
||||
To permanently mount the Windows shares, run:
|
||||
</para>
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
$ sudo update-rc.d -f umountnfs.sh remove
|
||||
$ sudo update-rc.d umountnfs.sh stop 15 0 6 .
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
special character to use instead of '$'. Choose a character that will not
|
||||
occur in your key names, e.g. ":":
|
||||
</para>
|
||||
<programlisting>
|
||||
<programlisting role="ini">
|
||||
<![CDATA[
|
||||
mongo.cmd = ":"
|
||||
]]>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</para>
|
||||
<para>
|
||||
<parameter>server</parameter> should have the form:
|
||||
<programlisting>
|
||||
<programlisting role="txt">
|
||||
<![CDATA[
|
||||
mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db
|
||||
]]>
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
On Red Hat variants, this can be caused by a default setting that does not
|
||||
allow Apache to create network connections. You can override this setting
|
||||
by running:
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
$ /usr/sbin/setsebool -P httpd_can_network_connect 1
|
||||
]]>
|
||||
|
|
|
@ -45,7 +45,7 @@ catch (MongoCursorException $e) {
|
|||
]]>
|
||||
</programlisting>
|
||||
This would produce output like:
|
||||
<programlisting>
|
||||
<programlisting role="txt">
|
||||
<![CDATA[
|
||||
error message: E11000 duplicate key error index: foo.bar.$_id_ dup key: { : 1 }
|
||||
error code: 11000
|
||||
|
|
|
@ -126,7 +126,7 @@ $db->execute(new MongoCode("print('Hello, '+user+'!');", $scope));
|
|||
not turn around and execute the input anyway! For example, never use the
|
||||
JavaScript <literal>eval</literal> function on user input:
|
||||
</para>
|
||||
<programlisting>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ $collection->insert(array("scores" => $scores));
|
|||
|
||||
<para>
|
||||
If you query for these objects using the database shell, they will look like:
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
> db.students.find()
|
||||
{ "_id" : ObjectId("4b06beada9ad6390dab17c43"), "scores" : [ 98, 100, 73, 85 ] }
|
||||
|
@ -271,7 +271,7 @@ $blog->insert($post2);
|
|||
|
||||
<para>
|
||||
From the database shell, this will look something like:
|
||||
<programlisting>
|
||||
<programlisting role="shell">
|
||||
<![CDATA[
|
||||
> db.blog.find()
|
||||
{ "_id" : ObjectId("4b06c263edb87a281e09dad8"), "author" : "Adam", "content" : "This is a blog post", "comments" : [ ], "date" : "Fri Nov 20 2009 11:22:59 GMT-0500 (EST)" }
|
||||
|
@ -292,11 +292,9 @@ $collection->insert($GLOBALS);
|
|||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
<programlisting role="txt">
|
||||
<![CDATA[
|
||||
|
||||
Fatal error: Nesting level too deep - recursive dependency?
|
||||
|
||||
]]>
|
||||
</programlisting>
|
||||
If you need to insert documents that may have recursive dependency, you have
|
||||
|
|
|
@ -83,7 +83,7 @@ $coll->update(array("username" => "joe"), array("userId" => 12345, "info" => arr
|
|||
<para>
|
||||
Suppose we wish to change the name of a comment's author in this document:
|
||||
|
||||
<programlisting>
|
||||
<programlisting role="javascript">
|
||||
<![CDATA[
|
||||
{
|
||||
"_id" : ObjectId("4b06c282edb87a281e09dad9"),
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<para>
|
||||
Suppose we wish to change the name of a comment's author in this document:
|
||||
|
||||
<programlisting>
|
||||
<programlisting role="javascript">
|
||||
<![CDATA[
|
||||
{
|
||||
"_id" : ObjectId("4b06c282edb87a281e09dad9"),
|
||||
|
|
Loading…
Reference in a new issue