使用Composer创建Symfony 3.4项目时遇PHP启动警告问题
Hey, let's fix that php_openssl warning you're hitting while setting up your Symfony 3.4 project with Composer. The error means PHP can't locate the openssl extension's dynamic library, so let's walk through the fixes step by step:
Check if php_openssl.dll exists in your extension directory
Head over toC:\php\extand look forphp_openssl.dll. If it's missing, you probably have an incomplete PHP installation. Grab the full PHP package matching your environment (thread-safe or non-thread-safe, 32/64-bit) and copy the missing dll into theextfolder.Update your php.ini configuration
First, find which php.ini file PHP is using by running this command in your terminal:php --iniOpen that file and do two things:
- Find the line that looks like
;extension=openssl(or;extension=php_openssl.dllfor older PHP versions) and remove the leading semicolon to uncomment it. - Make sure the
extension_dirsetting points to your correct extensions folder. It should look like:extension_dir = "C:\php\ext"
- Find the line that looks like
Fix system dependencies (Windows-only)
The openssl extension relies on two system files:libeay32.dllandssleay32.dll. These are usually in your PHP root directory. If they're not in your system's PATH, either copy them toC:\Windows\System32or place them directly in your PHP root folder.Restart your terminal/server
Any changes to php.ini won't take effect until you close and reopen your command line window. If you're using a web server (like Apache or Nginx), restart that too for good measure.Verify the fix
Run this command to check if openssl is now loaded:php -mLook for "openssl" in the list of modules. If it's there, you're good to go—rerun your Composer project creation command and the warning should be gone.
内容的提问来源于stack exchange,提问作者StevenG1

