我正在尝试在我的XAMPP php5.6开发人员服务器中设置mysql授权功能。但是,我无法让服务器启动。我尝试了很多代码变体,包括注释掉以DB开头的行。 #out out out使服务器启动,但在我尝试查看需要身份验证的页面时出现HTTP500错误,因为它不知道要查看的数据库。
Apache/2.4.26 (Win32) OpenSSL/1.0.2l PHP/5.6.31
的httpd.conf:
...
DBDriver mysql
DBDParams host=localhost,dbname=aDatabase,user=aUser,pass=ThisIsNotReallyMyPassword
<Directory "E:\xampp\htdocs\shouldnotbesecure\shouldbesecure">
Options -Indexes
AuthType Basic
AuthName "Please Login"
AuthBasicProvider dbd
# mod_authz_core configuration
Require valid-user
AuthDBDUserPWQuery "SELECT password FROM users WHERE username = %s"
</Directory>
在httpd.config中加载(来自phpinfo()命令):
Loaded Modules
core mod_win32 mpm_winnt http_core mod_so mod_access_compat mod_actions mod_alias mod_allowmethods mod_asis mod_auth_basic mod_authn_core mod_authn_dbd mod_authn_dbm mod_authn_file mod_authn_socache mod_authnz_fcgi mod_authz_core mod_authz_dbd mod_authz_dbm mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav_lock mod_dbd mod_dir mod_env mod_headers mod_include mod_info mod_isapi mod_logio mod_log_config mod_log_debug mod_log_forensic mod_cache_disk mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_rewrite mod_session_dbd mod_setenvif mod_socache_dbm mod_socache_shmcb mod_ssl mod_status mod_php5
当我尝试使用这些配置启动时,错误日志中没有显示任何内容,系统输出中显示的是以下通用消息:
5:38:11 PM [Apache] Checking default ports...
5:38:11 PM [Apache] Attempting to start Apache app...
5:38:11 PM [Apache] Executing "e:\xampp5.6\apache\bin\httpd.exe"
5:38:11 PM [Apache] Return code: 0
5:38:12 PM [Apache] Status change detected: running
5:38:12 PM [Apache] Status change detected: stopped
5:38:12 PM [Apache] Error: Apache shutdown unexpectedly.
5:38:12 PM [Apache] This may be due to a blocked port, missing dependencies,
5:38:12 PM [Apache] improper privileges, a crash, or a shutdown by another method.
5:38:12 PM [Apache] Press the Logs button to view error logs and check
5:38:12 PM [Apache] the Windows Event Viewer for more clues
5:38:12 PM [Apache] If you need more help, copy and post this
5:38:12 PM [Apache] entire log window on the forums