# Enabling OpenSSL Extension in PHP (Windows) ## Problem Your PHP installation doesn't have the OpenSSL extension enabled, which is required for secure SMTP connections (TLS/SSL). Current error: `Unable to find the socket transport "ssl"` or `TLS/SSL transports not available` ## Solution ### Option 1: Enable OpenSSL in php.ini (Recommended) 1. **Find your php.ini file:** ```powershell php --ini ``` If it shows "Loaded Configuration File: (none)", you need to create one: ```powershell # Find PHP installation directory where.exe php # Copy the example php.ini cd C:\path\to\php copy php.ini-development php.ini ``` 2. **Edit php.ini** and find this line: ```ini ;extension=openssl ``` Remove the semicolon to uncomment it: ```ini extension=openssl ``` 3. **Restart your PHP server** (or command line if using built-in server) 4. **Verify OpenSSL is enabled:** ```powershell php -m | Select-String -Pattern "openssl" ``` Should output: `openssl` ### Option 2: Enable OpenSSL temporarily via command line You can enable OpenSSL for a single command: ```powershell php -d extension=openssl test_email.php ``` Or for the built-in server: ```powershell php -d extension=openssl -S localhost:8000 ``` ### Option 3: Install Composer and PHPMailer If you can't modify php.ini, install PHPMailer which may handle SMTP better: ```powershell # Install Composer first (https://getcomposer.org/) # Then in the php/ directory: composer require phpmailer/phpmailer ``` The application will automatically detect and use PHPMailer if available. ## Verifying the Fix After enabling OpenSSL, run the test: ```powershell cd C:\Users\aky547\GitHub\SemapForm\php php test_email.php ``` You should see: - `Available transports: tcp, udp, ssl, tls` (or similar) - `TLS encryption enabled successfully` - `Email sent successfully via SMTP` ## Alternative: Use a Different SMTP Port If you absolutely cannot enable OpenSSL, you could try: 1. Contact your email administrator to see if there's an unencrypted SMTP port (not recommended for security) 2. Use a different email solution (e.g., send via a web service API instead of SMTP) ## Production Deployment On a production server (Linux/shared hosting): - OpenSSL is usually enabled by default - Check with `php -m | grep openssl` - If not available, contact your hosting provider - Most shared hosting environments have it pre-configured