Tuesday, June 18, 2024

Installing MongoDB Extension in XAMPP on Windows

If you're developing a PHP application and need to connect to a MongoDB database, you will need the MongoDB PHP extension. This guide walks you through the process of installing the MongoDB extension in XAMPP on a Windows system.

Step-by-Step Guide

1. Determine Your PHP Version

First, you need to know your PHP version to download the compatible MongoDB DLL file.

  1. Open the XAMPP Control Panel.
  2. Start Apache.
  3. Click on the "Admin" button next to Apache.
  4. A web browser will open. Create a new PHP file (e.g., info.php) in the htdocs directory with the following content:

    <?php phpinfo(); ?>
  5. Open this file in your browser by navigating to http://localhost/info.php.
  6. Look for the PHP version information on this page. Note down your PHP version (e.g., 8.2.4).

2. Download the MongoDB DLL File

Download the MongoDB DLL file that matches your PHP version from the MongoDB PHP driver GitHub releases page.

  1. Go to the MongoDB PHP driver GitHub releases page.
  2. Find the version that corresponds to your PHP version. For example, for PHP 8.2.4, download the php_mongodb-1.15.0-8.2-ts-x64.zip file (where ts stands for Thread Safe and x64 for 64-bit).
  3. Extract the downloaded ZIP file.

3. Copy the DLL Files to XAMPP's Extension Directory

After extracting the ZIP file, you will have the php_mongodb.dll and php_mongodb.pdb files. These need to be copied to the XAMPP extension directory.

  1. Navigate to the extracted files.
  2. Copy php_mongodb.dll and php_mongodb.pdb.
  3. Paste them into the XAMPP PHP extensions directory. Typically, this path is C:\xampp\php\ext.

4. Modify the PHP Configuration File

To load the MongoDB extension, you need to add it to the PHP configuration file (php.ini).

  1. Open the php.ini file located in the C:\xampp\php directory using a text editor (e.g., Notepad++ or VS Code).
  2. Search for the section where other extensions are enabled (look for lines starting with extension=).
  3. Add the following line to this section:
    extension=php_mongodb.dll
  4. Save and close the php.ini file.

5. Restart Apache

For the changes to take effect, you need to restart the Apache server.

  1. Open the XAMPP Control Panel.
  2. Stop the Apache server by clicking the "Stop" button next to Apache.
  3. Start the Apache server again by clicking the "Start" button.

6. Verify the Installation

To verify that the MongoDB extension is installed correctly:

  1. Open the info.php file again in your browser by navigating to http://localhost/info.php.
  2. Look for the MongoDB section in the output. If the installation was successful, you will see a section titled mongodb with information about the MongoDB extension.

Conclusion

By following these steps, you should have successfully installed the MongoDB extension for PHP in your XAMPP environment on Windows. This allows you to connect and interact with MongoDB databases from your PHP applications. Happy coding!

Saturday, July 18, 2020

How to generate Cirtificate signing request(csr),Key and Certificate(crt) files.

Recently I had a requirement to enable SSL in a web service. In order to enable the SSL in that web service, I was needed an SSL certificate file(CRT) and its Key file. I was using Godaddy hosting with Cpanel So, I am not a professional in system administration so that I had faced so many problems in generating those files - especially key file. all problems were ricing because of my lack of knowledge. after spending a whole 1 day and a lots of tries, I found the right way to do this. Here I will share with you my experience.

Please follow the steps below.

Generate CSR(certificate signing request from Cpanel)

A CSR is an encoded file that provides you with a standardized way to send DigiCert your public key as well as some information that identifies your company and domain name.

Follow the steps to get the CSR for the domain you wish to generate the certificate.

  1. Go to Cpanel.
  2. Go to section security. Open the option SSL/TLS.
  3. Fill the following required fields.
  4. Click on the generate button.
  5. You will get an encoded CSR and Key. Keep both CSR and Key files stored somewhere.

Generate a CRT(Certificate) file from GoDaddy

CRT is a file extension for a digital certificate file used with a web browser. CRT files are used to verify a secure website's authenticity, distributed by certificate authority (CA) companies such as GlobalSign, VeriSign, and Thawte.

Follow the steps to generate CRT file.

  1. Login into GoDaddy.
  2. Go to the SSL certificate page or Go to the section SSL certificates in My Products page(Normally, after login, GoDaddy will take you to the my products page). 
  3. Select the domain you wish to generate the SSL certificate, click on Manage Button(If you are accessing from My Products page).
  4. Go to the section Manage Certificate.
  5. Select the option Rekey your certificate.
  6. Put the signing request(CSR)  you generated before here in the text box.
  7. Then click on Submit all changes button.
If you check the status of the Certificates in the SSL certificate page, you can see its in Pending. Wait for some minutes. CA(Certificate issuer) will issue a certificate for you and you can see the status of the certificate as Issued. 

So now you can download the certificate appropriate to your server. follow the steps.

  1. Go to the Download Certificate section in the SSL Certificate page.
  2. Select the server type and click on the Download button.

Hope you understand.



Saturday, December 28, 2013

How to remove http://en.v9.com/ from Stat up page chrome

i tried more to get rid of this bloody page http://en.v9.com/
i changed my all settings in chrome browser and finally i found that it's not a problem of chrome extension
or a problem of start up page.

Finally i found that the issue in my chrome shortcut and i Fixed It..

Follow the steps.

Right button on chrome shortcut(Icon) 


Select Properties


In Target box clear text after this

"C:\Program Files\Google\Chrome\Application\chrome.exe"

Click OK

Then Open chrome see the magic...



Friday, November 29, 2013

How to Integrate Auto complete in Textbox JQuery

First of All Create a Text box

<label for="tags">Tags:</label>
<input id="tags">

Then to integrate autocomplete jquery Library Download JQuery UI file from Link HERE or Add server Link in your Head Section.


Just Like:

<script src="js/jquery-ui.js"></script>

OR

<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>

Then add items you want autocomplete to an array


var availableTags = [
        "shihab",
        "sabeer",
        "Tholhath",
        "Anju",
        "Anu",
        "shivin",
        "Jacob",
        "Sajeesh",
        "Jinesh",
        "Shibu",
        "Kiran",
        "Arjun",
        "Jamsheer",
        "Jam",
        "Boby",
        "Aji",
        "Subash",
        "Kumari",
        "Shahid",
        "Siraj",
        "Hari",

        "Radha"];

Then integrate Auto completion to a Control means TextBox.


$("#tags").autocomplete({
        source: availableTags,
        position: {
            my: "left top",
            at: "left bottom",
        }
    });

Use this styles for Good Look for auto Completion List


.footer-auto {
    background: gray;
    color: white;
}


Wednesday, November 27, 2013

phpMyAdmin - can't connect - invalid setings - ever since I added a root password - locked out

I Got the Error:

MySQL said: 
Cannot connect: invalid settings. 
phpMyAdmin tried to connect to the MySQL server, and the server rejected the
connection. You should check the host, username and password in your
configuration and make sure that they correspond to the information given
by the administrator of the MySQL server.
and I Solved it by using the solution written Below.

For wamp server:
IN: C:\wamp\apps\phpmyadminVERSION\config.inc.php
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true; 

$cfg['Servers'][$i]['AllowNoPasswordRoot'] = false; 
For xampp server:
because of xampp server had the following settings.
C:\xampp\phpMyAdmin\config.inc.php
$cfg['Servers'][$i]['user'] = 'root';

$cfg['Servers'][$i]['password'] = ''; // which is default setting in xampp server

$cfg['Servers'][$i]['password'] = 'your password';//type your password you have changed
DONE..

Error message “Forbidden You don't have permission to access / on this server"

Error:403 Forbidden You don't have permission to access / on this server

I faced the same issue, but I solved it by setting the options directive either in the global directory setting in the httpd.conf or in the specific directory block in httpd-vhosts.conf:
Options Indexes FollowSymLinks Includes ExecCGI
By default, your global directory settings is (httpd.conf line ~188):
<Directory />
    Options FollowSymLinks
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>
set the options to : Options Indexes FollowSymLinks Includes ExecCGI
Finally, it should look like:
<Directory />
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
</Directory>


DONE..

500 internal server error in zend framework

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
I Faced this error when i install wamp server and run a website using vitual host..

Then i googled for a solution. Finally i got solution which shows below


Using Zend Application you may see more information about the errors putting those lines inapplication.ini:
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
500 Errors are mostly caught exeptions. You may debug the problem looking at the variables inErrorController.php.
Also, the most common Apache issues:
  • mod_rewrite module not enabled in Apache
  • required RewriteBase / rule in .htaccess (on shared hostings)
  • missing AllowOverride All in virtual host configuration
DONE..