title: Installing Mongodb PHP Drivers on Ubuntu 18.04
body: <p>I have installed mongodb on a new Ubuntu 18.04 server. I can access and work with the database through the command line, but cannot access it via PHP, and was wondering how other people have gotten it to work.</p>
  
  <p>Following a new build of Ubuntu 18.04, and installation of LAMP, I ran:<br>
  <code>sudo apt install mongodb-server php-pear php7.2-dev
  sudo pecl install mongodb</code></p>
  
  <p>I then added the mongodb.so extension to the php.ini file, and a phpinfo(); page shows mongodb as installed. So far so good.</p>
  
  <p>If I browse to a test php page ($mongo=new Mongo();), the page fails to load though.</p>
  
  <p>Through web searches, I find the <a href="https://github.com/alcaeus/mongo-php-adapter" rel="nofollow noreferrer">https://github.com/alcaeus/mongo-php-adapter</a> page come up a lot, and I have run the composer installation command there, but to no avail.</p>
  
  <p>Installed versions are: Ubuntu 18.04.2 LTS; mongoDBv3.6.3; php 7.2.17; Apache 2.4.29</p>
  
  <p>I was wondering what steps other people who have gotten PHP to work successfully with Mongodb have followed? I plan to scrap this server and start from a fresh VM install again.</p>