We’ll be seeing how to install MongoDB and get it working with PHP.
If you had followed the step of installing mongo PECL extension you can undo it by doing the following, as this will be provided by the php5-mongo package, including the required changes in the php configuration, which we’ll be installing shortly afterwards.
- Removing any entry in the php.ini file that you made for mongo extension.
- Remove the PECL extension by:
sudo pecl uninstall mongo
Now do the following steps to complete the installation:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get install php5-mongo
After this restart your computer, only after that the MongoClient class will be available for use.
This is good page to find useful PHP scripts. PHPfront is a depository of PHP codes and snippets. Learn PHP from these free codes or add them to your own scripts. PHPfront is 100% free to use and supported by its own users. If you would like to add a snippet of code to the site, you can do so on the submit page.
It aims to be one of the biggest free PHP script repositories, but being still in the infancy it needs more users to join and add useful scripts. So as a community it can be made into a very good repository. It will surely help PHP beginners. But, i found some really interesting scripts in its presently small collection of scripts.
See it for yourself at-
Hey guys i’ve found out how to add php tags and hence examples to the blog. We just have to replace the ‘<‘ symbol in tags with a < statement, which will render the ‘<‘ symbol for us. Its as easy as that. The problem is that google or blogspot server supports the php and hence when i quote examples, they were actually parsing it, i.e, executing the php code. So in order to prevent that we’ll render the ‘<‘ symbol in the other way, and presto it works. Also put the examples within a <pre> </pre>, it will show the examples as a code-fragment(i.e, in that style).
echo "hello World";
The syntax-highlighting of the code is based on the post-
http://binil.wordpress.com/2007/09/06/formatting-source-in-blogs-hosted-on-wordpress. Now i’ll quote more php examples in the blog.
I had forgot one important component in the PHP programming, the Editor. The editor is very important to help you in efficient programming, it can help you with code-assist, code-complete(tag completion), code alignment, etc..
So now get hold of a good PHP editor(I use Easy-eclipse for PHP), and type in the following code-
This is an HTML line
echo “This is a PHP line”;
This is arguably the most popular PHP code. The above code’s output is the complete information about the PHP version you have installed and its modules..
To start with the PHP programming one should have the following tools-
- Web-Server-As PHP is a server side language one would need a web-server to run the PHP code. I’m using the Apache web-server.
- Database-One would essentially need one database for their website(in most cases). I would suggest MySQL, as it is a fully open-source.
Instead of downloading all the above tools, one-by one one can easily download one of the Integrated packages, called a Stack, that suits ones needs. I’m using the LAMP stack which can be used in Linux, with Apache as the Web-server, MySQL the database and PHP. The Windows equivalent is WAMP.
Many other stacks are also available, mostly in open-source visit the following site to select the Stack that suits your needs-
Guys, now what are u waiting for, get hold of the Stack of your choice and get going.
I’ve not yet added any example for PHP programs, as i’m unable to show the PHP tags, in the blog.. It simply won’t come visible in the blog, even though I type it. Can Anyone tell me how to make the PHP tags visible..
Please help me, its important..So as to keep the blog ticking… I’ll surely find a way around soon.