我目前在Windows Server 2008 R2上安装了PHP 5.5.12和Apache 2.4。 一切都运行完美,没有问题/警告。
我所做的是将相同的Apache文件/configuration复制到另一台服务器。 我复制了C:\PHP
目录,然后复制了C:\PHP
C:\Apache24
目录并将它们粘贴到新的服务器中。
然后,我用一个变化(即httpd -k install
)安装了Apache。我将端口号从80更改为8877. Apache正在处理没有问题,它正在8877端口上运行。 我也可以打开默认页面转到SERVER_IP_ADDRESS:8877,它的工作原理。
但是,PHP不能正常工作。 在Apache服务器的error.log文件中,我得到下面列出的警告
PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_curl.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_ldap.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_mysqli.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_openssl.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_pdo_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_sqlsrv_55_ts.dll' - The specified module could not be found.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_pdo_sqlsrv_55_ts.dll' - The specified module could not be found.\r\n in Unknown on line 0
我似乎无法弄清楚为什么我得到这个错误? C:\ PHP \ ext directoryphp中存在警告声明“指定的模块找不到”的所有.dll文件
PHP扩展位于
C:\php\exe
在文件php.ini里面我有这个variables
extension_dir = "ext"
这里是ext文件夹的目录列表
Volume in drive C is OS Volume Serial Number is C63C-1D75 Directory of C:\php\ext 07/29/2014 06:42 PM <DIR> . 07/29/2014 06:42 PM <DIR> .. 04/30/2014 02:46 PM 66,560 php_bz2.dll 04/30/2014 02:46 PM 72,704 php_com_dotnet.dll 04/30/2014 02:46 PM 507,392 php_curl.dll 04/30/2014 02:46 PM 18,944 php_enchant.dll 04/30/2014 02:46 PM 43,008 php_exif.dll 04/30/2014 02:46 PM 2,679,808 php_fileinfo.dll 04/30/2014 02:46 PM 1,358,848 php_gd2.dll 04/30/2014 02:46 PM 40,960 php_gettext.dll 04/30/2014 02:46 PM 240,128 php_gmp.dll 04/30/2014 02:46 PM 831,488 php_imap.dll 04/30/2014 02:46 PM 65,024 php_interbase.dll 04/30/2014 02:46 PM 261,632 php_intl.dll 04/30/2014 02:46 PM 179,200 php_ldap.dll 04/30/2014 02:46 PM 1,239,552 php_mbstring.dll 04/30/2014 02:46 PM 36,864 php_mysql.dll 04/30/2014 02:46 PM 88,576 php_mysqli.dll 04/30/2014 02:46 PM 141,824 php_oci8.dll 04/30/2014 02:46 PM 142,336 php_oci8_11g.dll 04/30/2014 02:46 PM 120,320 php_opcache.dll 04/30/2014 02:46 PM 72,704 php_openssl.dll 04/30/2014 02:46 PM 21,504 php_pdo_firebird.dll 04/30/2014 02:46 PM 24,576 php_pdo_mysql.dll 04/30/2014 02:46 PM 23,040 php_pdo_oci.dll 04/30/2014 02:46 PM 20,480 php_pdo_odbc.dll 04/30/2014 02:46 PM 27,648 php_pdo_pgsql.dll 04/30/2014 02:46 PM 465,408 php_pdo_sqlite.dll 08/28/2012 04:15 PM 186,520 php_pdo_sqlsrv_54_ts.dll 06/26/2013 03:22 PM 166,400 php_pdo_sqlsrv_55_ts.dll 04/30/2014 02:46 PM 90,112 php_pgsql.dll 04/30/2014 02:46 PM 12,288 php_shmop.dll 04/30/2014 02:46 PM 385,536 php_snmp.dll 04/30/2014 02:46 PM 236,544 php_soap.dll 04/30/2014 02:46 PM 54,784 php_sockets.dll 04/30/2014 02:46 PM 617,472 php_sqlite3.dll 08/28/2012 04:15 PM 204,952 php_sqlsrv_54_ts.dll 06/26/2013 03:22 PM 183,296 php_sqlsrv_55_ts.dll 04/30/2014 02:46 PM 31,744 php_sybase_ct.dll 04/30/2014 02:46 PM 236,544 php_tidy.dll 04/30/2014 02:46 PM 51,712 php_xmlrpc.dll 04/30/2014 02:46 PM 231,936 php_xsl.dll 40 File(s) 11,480,368 bytes 2 Dir(s) 83,103,895,552 bytes free
当我尝试访问网站时,我得到这个错误
致命错误:未定义的类常量“MYSQL_ATTR_INIT_COMMAND”
这是因为扩展没有加载。
我假设configuration是正确的,因为相同的configuration在不同的服务器上工作。
我该如何解决这个PHP启动问题?
像@Darren在评论中说,Apache不理解Windows系统中的php.ini
相对路径。
在PHP手册中,我们有一个如何在Microsoft Windows上安装Apache 2.x。 其中一条评论建议使用绝对路径。
所以,请尝试更改您的php.ini
的相对路径为绝对路径。
extension_dir="C:\full\path\to\php\ext"
使用绝对路径:
extension_dir="C:\full\path\here"