我如何解决错误消息“你的php安装似乎缺少wordpress所需的mysql扩展。” [英] How do i resolve the error message "your php installation appears to be missing the mysql extension which is required by wordpress."

查看:97
本文介绍了我如何解决错误消息“你的php安装似乎缺少wordpress所需的mysql扩展。”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:我在Apache Web服务器上本地安装了Wordpress,但是当我启动 http:/时,我收到一条错误消息/ localhost / wordpress / [ 1 ]



探测 - 常规:

首次安装Wordpress时会出现此问题。我确实安装了MySQL(最新64版);我验证了Apache能够运行 - 例如 - cgi脚本。我也设置了wordpress.php文件。我用它来检查MySQL的安装,它可以从PHP获得。我还设置了运行以下php代码的php_test(test.php)文件:



<?php 
phpinfo( );
?>





状态:问题尚未解决。



探针 - 研究:

我发现以下研究可能是相关的,我首先关注它:



 1。 WordPress>支持»您的PHP安装似乎缺少MySQL扩展... 
https://wordpress.org/support/topic/your-php-installation-appears-to-be-missing-the-mysql -extension-1

2. WordPress>支持»您的PHP安装似乎缺少MySQL扩展,需要
https://wordpress.org/support/topic/your-php -installation-seem-to-missing-the-mysql-extension-is-require





初始分辨率



相关文件是Apache的配置文件httpd.conf:



< pre lang =C#>#
#这个主要的Apache HTTP服务器配置文件。它包含
#配置指令,为服务器提供指令。
#请参阅< URL:http: // httpd.apache.org/docs/2.4/>详细信息。
#特别是,请参阅
#< URL:http: // httpd.apache.org/docs/2.4/mod/directives.html>
讨论每个配置指令。

#不要只是在中阅读中的说明而不理解
#他们。它们' 此处仅作为提示或提醒。如果您不确定
#,请参阅在线文档。你被警告了。

#配置和日志文件名称:如果您为许多
#服务器的
控制文件指定的文件名以开头 /(或 drive: / 对于 Win32),
#服务器将使用显式路径。如果文件名执行 *不*使用 #字符串> /,ServerRoot 的前缀 - 所以 logs / access_log
#,其中ServerRoot set to / usr / local / apache2将由
#服务器解释 as / usr / local / apache2 / logs / access_log ,而 / logs / access_log
#将被解释为< span class =code-keyword> as
' / logs / access_log'

#注意:如果指定了文件名,则必须使用正斜杠
#而不是反斜杠(例如, c:/ apache而不是 c:\ apache )。
#如果的驱动器号被省略,httpd.exe 所在的驱动器位于
#将由默认使用。 建议您始终提供
#an 显式驱动器号 in 绝对路径以避免混淆。


#ServerRoot:目录树的顶部,服务器' s
#保留配置,错误和日志文件。

#不要在目录路径的末尾添加斜杠。如果在非本地磁盘上指向
#ServerRoot,请确保在
#Mutex指令中指定本地磁盘(如果使用基于文件的互斥锁)。如果您希望为多个httpd守护进程共享
#相同的ServerRoot,则需要更改
#least PidFile。

ServerRootc:/ Apache24


#Mutex:允许您为个人设置互斥机制和互斥文件目录
#互斥,或更改全局默认值

#如果互斥锁是基于文件的,则取消注释并更改目录,默认的
#互斥文件目录不在本地磁盘上或不适合一些
#其他原因。

#Mutex默认值:logs


#Listen:允许您将Apache绑定到特定IP地址和/或
#端口,而不是默认的。另请参阅< VirtualHost>
#指令。

#将此更改为侦听特定IP地址,如下所示
#防止Apache冒成所有绑定的IP地址。

#Listen 12.34.56.78:80
收听80


#动态共享对象(DSO)支持

#为了能够使用作为DSO构建的模块的功能,你需要在这个<的位置放置相应的`LoadModule'行。 / span> location所以
#指令包含 它们实际可用_before_使用它们。
#静态编译的模块(由`httpd -l <​​span class =code-string>'
列出的模块)不需要
#要加载到这里。

#示例:
#LoadModule foo_module modules / mod_foo.so

LoadModule access_compat_module modules / mod_access_compat.so
LoadModule actions_module modules / mod_actions。所以
LoadModule alias_module modules / mod_alias.so
LoadModule allowmethods_module modules / mod_allowmethods.so
LoadModule asis_module modules / mod_asis.so
LoadModule auth_basic_module modules / mod_auth_basic.so
# LoadModule auth_digest_module modules / mod_auth_digest.so
#LoadModule auth_form_module modules / mod_auth_form.so
#LoadModule authn_anon_module modules / mod_authn_anon.so
LoadModule authn_core_module modules / mod_authn_core.so
#LoadModule authn_dbd_module modules /mod_authn_dbd.so
#LoadModule authn_dbm_module modules / mod_authn_dbm.so
LoadModule authn_file_module modules / mod_authn_file.so
#LoadModule authn_socache_module modules / mod_authn_socache.so
#LoadModule authnz_fcgi_module modules / mod_authnz_fcgi。所以
#LoadModule authnz_ldap_ module modules / mod_authnz_ldap.so
LoadModule authz_core_module modules / mod_authz_core.so
#LoadModule authz_dbd_module modules / mod_authz_dbd.so
#LoadModule authz_dbm_module modules / mod_authz_dbm.so
LoadModule authz_groupfile_module modules / mod_authz_groupfile .so
LoadModule authz_host_module modules / mod_authz_host.so
#LoadModule authz_owner_module modules / mod_authz_owner.so
LoadModule authz_user_module modules / mod_authz_user.so
LoadModule autoindex_module modules / mod_autoindex.so
#LoadModule buffer_module modules / mod_buffer.so
#LoadModule cache_module modules / mod_cache.so
#LoadModule cache_disk_module modules / mod_cache_disk.so
#LoadModule cache_socache_module modules / mod_cache_socache.so
# LoadModule cern_meta_module modules / mod_cern_meta.so
LoadModule cgi_module modules / mod_cgi.so
#LoadModule charset_lite_module modules / mod_charset_lite.so
#LoadModule data_module modules / mod_data.so
#LoadModule dav_modul e modules / mod_dav.so
#LoadModule dav_fs_module modules / mod_dav_fs.so
#LoadModule dav_lock_module modules / mod_dav_lock.so
#LoadModule dbd_module modules / mod_dbd.so
#LoadModule deflate_module modules /mod_deflate.so
LoadModule dir_module modules / mod_dir.so
#LoadModule dumpio_module modules / mod_dumpio.so
LoadModule env_module modules / mod_env.so
#LoadModule expires_module modules / mod_expires.so
#LoadModule ext_filter_module modules / mod_ext_filter.so
#LoadModule file_cache_module modules / mod_file_cache.so
#LoadModule filter_module modules / mod_filter.so
#LoadModule http2_module modules / mod_http2.so
#LoadModule headers_module modules / mod_headers.so
#LoadModule heartbeat_module modules / mod_heartbeat.so
#LoadModule heartmonitor_module modules / mod_heartmonitor.so
#LoadModule ident_module modules / mod_ident.so
#LoadModule imagemap_module modules / mod_imagemap.so
LoadModule include_module modules / mod_include.so
#LoadModule info_module模块/ mod_info.so
的LoadModule isapi_module模块/ mod_isapi.so
#LoadModule lbmethod_bybusyness_module模块/ mod_lbmethod_bybusyness.so
#LoadModule lbmethod_byrequests_module模块/ mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules / mod_lbmethod_bytraffic.so
#LoadModule lbmethod_heartbeat_module modules / mod_lbmethod_heartbeat.so
#LoadModule ldap_module modules / mod_ldap.so
#LoadModule logio_module modules / mod_logio.so
LoadModule log_config_module modules / mod_log_config.so
#LoadModule log_debug_module modules / mod_log_debug.so
#LoadModule log_forensic_module modules / mod_log_forensic.so
#LoadModule lua_module modules / mod_lua.so
#LoadModule macro_module modules /mod_macro.so
LoadModule mime_module modules / mod_mime.so
#LoadModule mime_magic_module modules / mod_mime_magic.so
LoadModule negotiation_module modules / mod_negotiation.so
#LoadModule proxy_module module s / mod_proxy.so
#LoadModule proxy_ajp_module modules / mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules / mod_proxy_balancer.so
#LoadModule proxy_connect_module modules / mod_proxy_connect.so
#LoadModule proxy_express_module modules / mod_proxy_express.so
#LoadModule proxy_fcgi_module modules / mod_proxy_fcgi.so
#LoadModule proxy_ftp_module modules / mod_proxy_ftp.so
#LoadModule proxy_html_module modules / mod_proxy_html.so
#LoadModule proxy_http_module modules / mod_proxy_http。所以
#LoadModule proxy_scgi_module modules / mod_proxy_scgi.so
#LoadModule proxy_wstunnel_module modules / mod_proxy_wstunnel.so
#LoadModule ratelimit_module modules / mod_ratelimit.so
#LoadModule reflector_module modules / mod_reflector.so
#LoadModule remoteip_module modules / mod_remoteip.so
#LoadModule request_module modules / mod_request.so
#LoadModule reqtimeout_module modules / mod_reqtimeout.so
#LoadModule rewrite_module modules / mod_rewrite.so
#LoadModule sed_module modules / mod_sed.so
#LoadModule session_module modules / mod_session.so
#LoadModule session_cookie_module modules / mod_session_cookie.so
#LoadModule session_crypto_module modules / mod_session_crypto.so
#LoadModule session_dbd_module modules / mod_session_dbd.so
LoadModule setenvif_module modules / mod_setenvif.so
#LoadModule slotmem_plain_module modules / mod_slotmem_plain.so
#LoadModule slotmem_shm_module modules / mod_slotmem_shm.so
#LoadModule socache_dbm_module modules / mod_socache_dbm.so
#LoadModule socache_memcache_module modules / mod_socache_memcache.so
#LoadModule socache_shmcb_module modules / mod_socache_shmcb.so
#LoadModule speling_module modules / mod_speling.so
#LoadModule ssl_module modules / mod_ssl。所以
#LoadModule status_module modules / mod_status.so
#LoadModule substitute_module modules / mod_substitute.so
#LoadModule unique_id_module modules / mod_unique_id.so
#LoadModule userdir_module module s / mod_userdir.so
#LoadModule usertrack_module modules / mod_usertrack.so
#LoadModule version_module modules / mod_version.so
#LoadModule vhost_alias_module modules / mod_vhost_alias.so
#LoadModule watchdog_module modules / mod_watchdog.so
#LoadModule xml2enc_module modules / mod_xml2enc.so

< IfModule unixd_module>

#如果您希望httpd作为不同的用户或组运行,您必须最初以root身份运行
#httpd,它将切换。

#用户/组:运行httpd的用户/组的名称(或#number)。
#与大多数系统服务一样,为
#运行httpd创建专用用户和组通常是一种好习惯。

用户守护程序
组守护程序

< / IfModule>

#'
主要' 服务器配置

#本节中的指令设置'
main '
#使用的值服务器,它响应任何不被
#< VirtualHost>处理的请求。定义。这些值还为

#any< VirtualHost>提供默认值您可以稍后在文件中定义的容器。

#所有这些指令都可能出现在< VirtualHost>内。容器,
其中 case 这些默认值设置将被覆盖,用于定义的
虚拟主机。



#ServerAdmin:你的地址,其中服务器的问题应该是
#通过电子邮件发送。此地址出现在某些服务器生成的页面上,例如
错误文档。例如admin@your-domain.com

ServerAdmin admin@example.com


#ServerName给出服务器用来标识自身的名称和端口。
#这通常可以自动确定,但我们建议您明确指定
#,以防止启动时出现问题。

#如果你的主机没有' t有一个注册的DNS名称,请输入其IP地址这里。

#ServerName www.example.com:80


#拒绝访问整个服务器的
文件系统。您必须
#明确允许访问其他
#< Directory>中的web内容目录。块下面。

<目录/>
AllowOverride none
要求所有拒绝
< / 目录 < span class =code-keyword>>



#请注意来自 指向您必须明确允许启用
#特定功能 - 所以如果某事' 不能用作
#你可能期望的,请确保你已经专门启用它
#下面。



#DocumentRoot:您将提供
#文件的目录。默认情况下,所有请求都来自此目录,但
#符号链接和别名可用于指向其他位置。

DocumentRootc:/ Apache24 / htdocs
< Directoryc:/ Apache24 / htdocs>

#Options指令的可能值为None,All,
#或以下任意组合:
#索引包括FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

#请注意,MultiViews必须明确命名* ---选项全部
#doesn'
给你。

#Options指令 既复杂又重要。请参阅
#http: // httpd.apache.org/docs/2.4/mod/core.html #options
更多信息。

选项索引FollowSymLinks


#AllowOverride控制在
.htaccess中放置的指令文件。
#可以是 全部 ,或关键字的任意组合:
#AllowOverride FileInfo AuthConfig限制

AllowOverride无


#控制谁可以获取东西来自 服务器。

要求所有已授予
< / 目录 >


#DirectoryIndex:设置Apache将提供的文件 if 一个目录
请求的。

< IfModule dir_module>
DirectoryIndex index.php index.html
< / IfModule >


#以下行阻止.htaccess和.htpasswd文件来自
#由Web客户端查看。

< Files 。ht * >
要求所有拒绝
< / 文件 >


#ErrorLog:错误日志文件的位置。
#如果 未在< VirtualHost>中指定ErrorLog指令
#container,与虚拟主机相关的错误消息将在此处记录
#。如果你*为*
a< VirtualHost>定义错误日志文件
#container,主机' 的错误将记录在那里,而不是在这里。

ErrorLoglogs / error.log


#LogLevel:控制记录到error_log的消息数。
#可能的值包括:debug,info,notice,warn,error,crit,
#alert,emerg。

LogLevel警告

< IfModule log_config_module>

#以下指令定义了一些格式昵称,用于
#一个CustomLog指令(见下文)。

LogFormat%h%l%u%t \%r \%> s%b \%{Referer} i \\%{用户-Agent} i \合并
LogFormat%h%l%u%t \%r \%> s%b普通

< IfModule logio_module>
#你需要启用mod_logio.c来使用%I和%O
LogFormat%h%l%u%t \%r \%> s%b \ %{Referer} i \\%{User-Agent} i \%I%Ocombinedio
< / IfModule>


#访问日志文件的位置和格式(通用日志文件格式)。
#如果您未在< VirtualHost>中定义任何访问日志文件
#container,他们将被记录在这里。相反,如果你*做*
#define per-< VirtualHost>访问日志文件,事务将在其中记录
#和此文件中的* not *。

CustomLoglogs / access.logcommon


#如果您更喜欢带有访问权限,代理和引用信息的日志文件
# (组合日志文件格式)您可以使用以下指令。

#CustomLoglogs / access.log合并
< / IfModule>

< IfModule alias_module>

#重定向:允许您告诉客户有关服务器
s 命名空间中存在的
#的文档
,但不再了。客户端
#将在文档 new 请求代码关键字>新位置。
#示例:
#重定向permanent / foo http: // www.example.com/ bar


#别名:将网络路径映射到文件系统路径和 用于
#访问不在DocumentRoot下的内容。
#示例:
#Alias / webpath / full / filesystem / path

#如果包含尾随/ on / webpath,那么服务器将为
#require它将在 URL中出现。您也可能需要
#来提供<目录>允许访问
#文件系统路径的部分。


#ScriptAlias:它控制哪些目录包含服务器脚本。
#ScriptAliases基本上与 别名相同,只是
#documents 目标目录被视为作为应用程序,
#由服务器运行时请求而不是< span class =code-keyword> as
发​​送到
#客户端的文档。关于尾随 /的相同规则适用于ScriptAlias
#directives as 到Alias。

ScriptAlias / cgi-bin / c:/ Apache24 / cgi-bin /

< / IfModule >

< IfModule cgid_module>

#ScriptSock:在线程服务器上,指定用于与mod_cgid的CGI守护进程通信的UNIX
#套接字的路径。

#Scriptsock cgisock
< / IfModule >


c:/ Apache24 / cgi-bin应更改为您的ScriptAliased
#CGI目录存在,如果你有配置。

<目录 c:/ Apache24 / cgi-bin >
AllowOverride无
#选项无
#SE:以上内容根据http修改: // editrocket.com/articles/perl_apache_windows.html
选项索引FollowSymLinks ExecCGI
要求所有授予
< / 目录 >

< IfModule mime_module>

#TypesConfig指向包含映射列表的文件
#文件扩展名到MIME类型。

TypesConfig conf / mime.types


#AddType允许您添加到或覆盖 MIME配置
#文件指定 TypesConfig for 特定文件类型。

#AddType application / x-gzip .tgz

#AddEncoding允许您让某些浏览器动态解压缩
#信息。注意:并非所有浏览器都支持

#AddEncoding x-compress .Z
#AddEncoding x-gzip .gz .tgz

#如果上面的AddEncoding指令被注释掉,那么你
#可能应该定义那些扩展来表示媒体类型:

AddType application / x-compress .Z
AddType application / x-gzip .gz .tgz


#AddHandler允许您将某些文件扩展名映射到 handlers
#与filetype无关的动作。这些可以构建服务器
#中,或者用Action指令添加(见下文)

#使用CGI ScriptAliased目录之外的脚本:
#(您还需要添加 ExecCGI 选项指令。)

AddHandler cgi-script .cgi .pl

#对于类型映射(协商资源):
#AddHandler type-map var


#过滤器允许您在 发​​送到客户端之前处理内容。

#解析.shtml文件 服务器端包含(SSI):
#(您还需要< span class =code-keyword> add
包含 选项指令。)

#AddType text / html .shtml
#AddOutputFilter INCLUDES .shtml
< / IfModule >


#mod_mime_magic模块允许服务器使用来自
$ b的各种提示 $ b#文件本身的内容,以确定其类型。 MIMEMagicFile
#指令告诉模块 提示定义所在的位置。

#MIMEMagicFile conf / magic


#可自定义的错误响应来自 三种风格:
1 )纯文本 2 )本地重定向 3 )外部重定向

#例如:
#ErrorDocument 500 服务器发起了嘘声。
#ErrorDocument 404 /missing.html
#ErrorDocument 404 /cgi-bin/missing_handler.pl
#ErrorDocument 402 http: // www.example.com/subscription_info.html



#MaxRanges:最大数量范围
#re之前的请求转动整个资源,或者一个特殊的
#值' default'' none'' 无限'
#默认设置 接受 200 范围。
#MaxRanges unlimited


#EnableMMAP和EnableSendfile:在支持它的系统上,
#memory-mapping或sendfile系统调用可用于提供
#文件。这通常可以提高服务器性能,但是当
网络安装时,必须关闭

#filesystems或如果支持 这些函数否则
#在您的系统上损坏。
#默认值:EnableMMAP On,EnableSendfile Off

#EnableMMAP off
#EnableSendfile on

#Supplemental configuration

#配置文件 conf / extra /目录中的
#包含在 add 中额外功能或修改
#服务器的默认配置,或者您可以在此处复制其内容并更改 as
#必要。

#服务器池管理(特定于MPM)
#Include conf / extra / httpd-mpm.conf

#多语言错误消息
#Include conf / extra / httpd-multilang-errordoc.conf

#精美目录列表
#Include conf / extra / httpd-autoindex.conf

#语言设置
#Include conf / extra / httpd-languages.conf

#用户主目录
#Include conf / extra / httpd-userdir.conf

#关于请求和配置的实时信息
#Include conf / extra / httpd-info.conf

#虚拟主机
#Include conf / extra / httpd-vhosts。 conf

#本地访问Apache HTTP Server手册
#Include conf / extra / httpd-manual.conf

#分布式创作和版本控制(WebDAV)
#Include conf / extra / httpd-dav.conf

#各种默认设置
#Include conf / extra / httpd-default.conf

#配置mod_proxy_html以理解HTML4 / XHTML1
< IfModule pr oxy_html_module>
包括conf / extra / proxy-html.conf
< / IfModule >

#安全(SSL / TLS)连接
#Include conf / extra / httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
# but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

# Customer Installation per: https://docs.moodle.org/29/en/Manual_install_on_Windows_7_with_Apache_and_MySQL
# LoadModule php5_module \"C:/PHP/php5apache2_4.dll\"
# AddHandler application/x-httpd-php .php
# PHPIniDir C:/PHP

#Intallation of the php mode per: https://wordpress.org/support/topic/missing-the-mysql-extension-1
#This LoadModule is not available
#LoadModule php5_module modules/libphp5.so
LoadModule php5_module \"C:/PHP/php5apache2 _4.dll\"
PHPIniDir C:/PHP

#First option - only php files
#<FilesMatch \.php$>
#SetHandler application/x-httpd-php
#</FilesMatch>

#Second option - php .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP
<FilesMatch \"\.ph(p[2-6]?|tml)$\">
SetHandler application/x-httpd-php
</FilesMatch>

#Third option - And to allow .phps files to be executed as PHP source files, add this:

<FilesMatch \"\.phps$\">
SetH andler application/x-httpd-php-source
</FilesMatch>





When I read the question, only the top part of the httpd.conf files shows. So below is the rest of it. The very bottom part is what is important in terms of PHP and MySQL being able to load.



#Intallation of the php mode per: https://wordpress.org/support/topic/missing-the-mysql-extension-1

#This LoadModule is not available

#LoadModule php5_module modules/libphp5.so

LoadModule php5_module \"C:/PHP/php5apache2_4.dll\"

PHPIniDir C:/PHP



#First option - only php files

#<FilesMatch \.php$>

#SetHandler application/x-httpd-php

#</FilesMatch>



#Second option - php .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP

<FilesMatch \"\.ph(p[2-6]?|tml)$\">

SetHandler application/x-httpd-php

</FilesMatch>



#Third option - And to allow .phps files to be executed as PHP source files, add this:



<FilesMatch \"\.phps$\" >

SetHandler application/x-httpd-php-source

</FilesMatch>



What I have tried:



1. I tried creating a simple php file to connect to MySQL - same issue; so the problem is not Wordpress; also commented section by section in the code to find out that the error was not a login problem. I got the error message, \"No connection could be made because the target machine actively refused it.\"



<?php 
// From: https://dev.mysql.com/doc/apis-php/en/apis-php-function.mysql-connect.html
// we connect to example.com and port 3307

$link = mysql_connect('localhost:3307', 'Wordpress', 'the_actual_password');
if (!$link) {
die('Could not connect localhost:3307 : ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

// we connect to localhost at port 3307
//$link = mysql_connect('127.0.0.1:3307', 'Wordpress', 'the_actual_password');
if (!$link) {
die('Could not connect 127.0.0.1:3307 : ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

//Following mysql_connect(): No connection could be made because the target machine actively refused it
//See http://stackoverflow.com/questions/21987746/mysql-connect-no-connection-could-be-made-because-the-target-machine-actively

// we connect to localhost at port 3307
$link = mysql_connect(\"localhost\",\"root\" ,\"\"); // will connect
if (!$link) {
die('Could not connect localhost as root: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

?>





I tried disabling the firewall - not allowed by group policy; I tried with Windows 7 going to Windows Firewall with Advanced Security and creating a custom inbound rule for port 3306 as well as a custom outbound rule for port 3306 allowing inbound and outbound access on those ports - same issue.



I tried using the open office base program - I attempted to launch the program after installation; the program does not launch! The next step is to restart the windows machine.



I tried to research the issue further also:



3. How do I resolve the error message \"Your PHP installation appears to be missing the MySQL extension which is required by WordPress.\" -Google 

4. WordPress › Support » Your PHP installation appears to be missing the MySQL extension...
https://wordpress.org/support/topic/your-php-installation-appears-to-be-missing-the-mysql-extension-1

5. WordPress › Support » Your PHP installation appears to be missing the MySQL extension which is require
https://wordpress.org/support/topic/your-php-installation-appears-to-be-missing-the-mysql-extension-which-is-require

6. phpinfo()
http://localhost/test.php

7. file:///c:/PHP/php.ini
file:///c:/PHP/php.ini

8. file:///c:/PHP/php.ini
file:///c:/PHP/php.ini

9. phpinfo()
http://localhost/test.php

10. how to have php load config file again -Google


11. PHP: Command line usage - Manual
http://php.net/manual/en/features.commandline.php

12. how to check php mysql from the php command line - Google

13. PHP: mysql_connect - Manual
http: //php.net/manual/en/function.mysql-connect.php

14. php command line shell tutorial -Google


15. Command-line PHP? Yes, you can!
http://www.ibm.com/developerworks/library/os-php-command/

16. file:///c:/Apache24/logs/error.log
file:///c:/Apache24/logs/error.log

17. php connect to mysql database with the mysql module -Google

18. PHP/MySQL Tutorial - Learn how to connect MySQL with PHP
https://www.siteground.com/tutorials/php-mysql/php_mysql_connection.htm

19. PHP/MySQL Tutorial - Learn how to establish MySQL connection
https://www.siteground.com/tutorials/php-mysql/database_connection.htm

20. PHP Connect to MySQL
http://www.w3schools.com/php/php_mysql_connect.asp

21. PHP: Comments - Manual
http://php.net/manual/en/language.basic-syntax.comments.php

22. php mysql mysql_connect example - Google

23. MySQL :: MySQL PHP API :: 5.5.4 mysql_connect
https://dev.mysql.com/doc/apis-php/en/apis-php-function.mysql-connect.html

24. php mysql_connect(): No connection could be made because the tar get machine actively refused it. -Google

25. php - mysql_connect(): No connection could be made because the target machine actively refused it - Stack Overflow
http://stackoverflow.com/questions/21987746/mysql-connect-no-connection-could-be-made-because-the-target-machine-actively

26. how to verify windows 7 firewall connection for localhost -Google


27. networking - How to check if a port is blocked on a Windows machine? - Server Fault
http://serverfault.com/questions/26564/how-to-check-if-a-port-is-blocked-on-a-windows-machine

28. windows 7 netstat -a -n - Google Search

29. mysql netstat state established - Google Search


30. MySQL :: mysql, number of TCP connections does not match on server / client machines
http://forums.mysql.com/read.php?39,581155,581155

31. NETSTAT - The Easy Tutorial
http://openmaniak.com/netstat.php

32. how to verify windows 7 firewall connection for localhost - Google Search

33. networking - How to check if a port is blocked on a Windows machine? - Server Fault
http://serverfault.com/questions/26564/how-to-check-if-a-port-is-blocked-on-a-windows-machine

34. start windows firewall logging windows 7 - Google Search

35. Configure the Windows Firewall Log
https://technet.microsoft.com/en-us/library/cc947815(v=ws.10).aspx

解决方案

>
#SetHandler application/x-httpd-php
#</FilesMatch>

#Second option - php .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP
<FilesMatch \"\.ph(p[2-6]?|tml)


\">
SetHandler application/x-httpd-php
</FilesMatch>

#Third option - And to allow .phps files to be executed as PHP source files, add this:

<FilesMatch \"\.phps


\">
SetHandler application/x-httpd-php-source
</FilesMatch>





When I read the question, only the top part of the httpd.conf files shows. So below is the rest of it. The very bottom part is what is important in terms of PHP and MySQL being able to load.



#Intallation of the php mode per: https://wordpress.org/support/topic/missing-the-mysql-extension-1

#This LoadModule is not available

#LoadModule php5_module modules/libphp5.so

LoadModule php5_module \"C:/PHP/php5apache2_4.dll\"

PHPIniDir C:/PHP



#First option - only php files

#<FilesMatch \.php


Issue: I installed Wordpress locally on an Apache web server, but I get an error message when I launch "http://localhost/wordpress/"[1]

Probe - General:
This issue occurs at first installation of Wordpress. I did install MySQL (latest 64 version); and I verified that Apache is able to run - for instance - cgi scripts. I did setup the wordpress.php file also. I am using this to check the MySQL installation, that it is available from PHP. I also setup a php_test (test.php) file that runs the following php code:

<?php
phpinfo();
?>



Status: The issue is not yet resolved.

Probe - Research:
I found the following research might be relevant and I am focusing on it first:

1. WordPress › Support » Your PHP installation appears to be missing the MySQL extension...
https://wordpress.org/support/topic/your-php-installation-appears-to-be-missing-the-mysql-extension-1

2. WordPress › Support » Your PHP installation appears to be missing the MySQL extension which is require
https://wordpress.org/support/topic/your-php-installation-appears-to-be-missing-the-mysql-extension-which-is-require



Initial resolution

The file that is relevant is Apache's configuration file httpd.conf:

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see 
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" 
# will be interpreted as '/logs/access_log'.
#
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
# If a drive letter is omitted, the drive on which httpd.exe is located
# will be used by default.  It is recommended that you always supply
# an explicit drive letter in absolute paths to avoid confusion.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "c:/Apache24"

#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
#LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule authz_core_module modules/mod_authz_core.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule data_module modules/mod_data.so
#LoadModule dav_module modules/mod_dav.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
#LoadModule dumpio_module modules/mod_dumpio.so
LoadModule env_module modules/mod_env.so
#LoadModule expires_module modules/mod_expires.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule filter_module modules/mod_filter.so
#LoadModule http2_module modules/mod_http2.so
#LoadModule headers_module modules/mod_headers.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule ident_module modules/mod_ident.so
#LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
#LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule logio_module modules/mod_logio.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule lua_module modules/mod_lua.so
#LoadModule macro_module modules/mod_macro.so
LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_html_module modules/mod_proxy_html.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule request_module modules/mod_request.so
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_crypto_module modules/mod_session_crypto.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule status_module modules/mod_status.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule unique_id_module modules/mod_unique_id.so
#LoadModule userdir_module modules/mod_userdir.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule version_module modules/mod_version.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule xml2enc_module modules/mod_xml2enc.so

<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin admin@example.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<Files ".ht*">
    Require all denied
</Files>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error.log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "logs/access.log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access.log" combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts. 
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock cgisock
</IfModule>

#
# "c:/Apache24/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "c:/Apache24/cgi-bin">
    AllowOverride None
#    Options None
#  SE:  The above was modified per http://editrocket.com/articles/perl_apache_windows.html
    Options Indexes FollowSymLinks ExecCGI 
    Require all granted
</Directory>

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    AddHandler cgi-script .cgi .pl

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it, 
# memory-mapping or the sendfile syscall may be used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted 
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
#EnableSendfile on

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be 
# included to add extra features or to modify the default configuration of 
# the server, or you may simply copy their contents here and change as 
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
#Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

# Customer Installation per:  https://docs.moodle.org/29/en/Manual_install_on_Windows_7_with_Apache_and_MySQL
#   LoadModule php5_module "C:/PHP/php5apache2_4.dll"
#   AddHandler application/x-httpd-php .php
#   PHPIniDir C:/PHP

#Intallation of the php mode per:  https://wordpress.org/support/topic/missing-the-mysql-extension-1   
#This LoadModule is not available
#LoadModule php5_module modules/libphp5.so
LoadModule php5_module "C:/PHP/php5apache2_4.dll"
PHPIniDir C:/PHP

#First option - only php files
#<FilesMatch \.php$>
#SetHandler application/x-httpd-php
#</FilesMatch>

#Second option - php  .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP
<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>

#Third option -  And to allow .phps files to be executed as PHP source files, add this:

<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>



When I read the question, only the top part of the httpd.conf files shows. So below is the rest of it. The very bottom part is what is important in terms of PHP and MySQL being able to load.

#Intallation of the php mode per: https://wordpress.org/support/topic/missing-the-mysql-extension-1
#This LoadModule is not available
#LoadModule php5_module modules/libphp5.so
LoadModule php5_module "C:/PHP/php5apache2_4.dll"
PHPIniDir C:/PHP

#First option - only php files
#<FilesMatch \.php$>
#SetHandler application/x-httpd-php
#</FilesMatch>

#Second option - php .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP
<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>

#Third option - And to allow .phps files to be executed as PHP source files, add this:

<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>

What I have tried:

1. I tried creating a simple php file to connect to MySQL - same issue; so the problem is not Wordpress; also commented section by section in the code to find out that the error was not a login problem. I got the error message, "No connection could be made because the target machine actively refused it."

<?php
// From:  https://dev.mysql.com/doc/apis-php/en/apis-php-function.mysql-connect.html
// we connect to example.com and port 3307

$link = mysql_connect('localhost:3307', 'Wordpress', 'the_actual_password');
if (!$link) {
    die('Could not connect localhost:3307 : ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

// we connect to localhost at port 3307
//$link = mysql_connect('127.0.0.1:3307', 'Wordpress', 'the_actual_password');
if (!$link) {
    die('Could not connect 127.0.0.1:3307 : ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

//Following mysql_connect(): No connection could be made because the target machine actively refused it
//See http://stackoverflow.com/questions/21987746/mysql-connect-no-connection-could-be-made-because-the-target-machine-actively

// we connect to localhost at port 3307
$link =  mysql_connect("localhost","root" ,""); // will connect
if (!$link) {
    die('Could not connect localhost as root: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
 
?>



I tried disabling the firewall - not allowed by group policy; I tried with Windows 7 going to Windows Firewall with Advanced Security and creating a custom inbound rule for port 3306 as well as a custom outbound rule for port 3306 allowing inbound and outbound access on those ports - same issue.

I tried using the open office base program - I attempted to launch the program after installation; the program does not launch! The next step is to restart the windows machine.

I tried to research the issue further also:

3. How do I resolve the error message "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." -Google

4. WordPress › Support » Your PHP installation appears to be missing the MySQL extension...
https://wordpress.org/support/topic/your-php-installation-appears-to-be-missing-the-mysql-extension-1

5. WordPress › Support » Your PHP installation appears to be missing the MySQL extension which is require
https://wordpress.org/support/topic/your-php-installation-appears-to-be-missing-the-mysql-extension-which-is-require

6. phpinfo()
http://localhost/test.php

7. file:///c:/PHP/php.ini
file:///c:/PHP/php.ini

8. file:///c:/PHP/php.ini
file:///c:/PHP/php.ini

9. phpinfo()
http://localhost/test.php

10. how to have php load config file again -Google


11. PHP: Command line usage - Manual
http://php.net/manual/en/features.commandline.php

12. how to check php mysql from the php command line - Google

13. PHP: mysql_connect - Manual
http://php.net/manual/en/function.mysql-connect.php

14. php command line shell tutorial -Google


15. Command-line PHP? Yes, you can!
http://www.ibm.com/developerworks/library/os-php-command/

16. file:///c:/Apache24/logs/error.log
file:///c:/Apache24/logs/error.log

17. php connect to mysql database with the mysql module -Google

18. PHP/MySQL Tutorial - Learn how to connect MySQL with PHP
https://www.siteground.com/tutorials/php-mysql/php_mysql_connection.htm

19. PHP/MySQL Tutorial - Learn how to establish MySQL connection
https://www.siteground.com/tutorials/php-mysql/database_connection.htm

20. PHP Connect to MySQL
http://www.w3schools.com/php/php_mysql_connect.asp

21. PHP: Comments - Manual
http://php.net/manual/en/language.basic-syntax.comments.php

22. php mysql mysql_connect example - Google

23. MySQL :: MySQL PHP API :: 5.5.4 mysql_connect
https://dev.mysql.com/doc/apis-php/en/apis-php-function.mysql-connect.html

24. php mysql_connect(): No connection could be made because the target machine actively refused it. -Google

25. php - mysql_connect(): No connection could be made because the target machine actively refused it - Stack Overflow
http://stackoverflow.com/questions/21987746/mysql-connect-no-connection-could-be-made-because-the-target-machine-actively

26. how to verify windows 7 firewall connection for localhost -Google


27. networking - How to check if a port is blocked on a Windows machine? - Server Fault
http://serverfault.com/questions/26564/how-to-check-if-a-port-is-blocked-on-a-windows-machine

28. windows 7 netstat -a -n - Google Search

29. mysql netstat state established - Google Search


30. MySQL :: mysql, number of TCP connections does not match on server / client machines
http://forums.mysql.com/read.php?39,581155,581155

31. NETSTAT - The Easy Tutorial
http://openmaniak.com/netstat.php

32. how to verify windows 7 firewall connection for localhost - Google Search

33. networking - How to check if a port is blocked on a Windows machine? - Server Fault
http://serverfault.com/questions/26564/how-to-check-if-a-port-is-blocked-on-a-windows-machine

34. start windows firewall logging windows 7 - Google Search

35. Configure the Windows Firewall Log
https://technet.microsoft.com/en-us/library/cc947815(v=ws.10).aspx

解决方案

> #SetHandler application/x-httpd-php #</FilesMatch> #Second option - php .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP <FilesMatch "\.ph(p[2-6]?|tml)


"> SetHandler application/x-httpd-php </FilesMatch> #Third option - And to allow .phps files to be executed as PHP source files, add this: <FilesMatch "\.phps


"> SetHandler application/x-httpd-php-source </FilesMatch>



When I read the question, only the top part of the httpd.conf files shows. So below is the rest of it. The very bottom part is what is important in terms of PHP and MySQL being able to load.

#Intallation of the php mode per: https://wordpress.org/support/topic/missing-the-mysql-extension-1
#This LoadModule is not available
#LoadModule php5_module modules/libphp5.so
LoadModule php5_module "C:/PHP/php5apache2_4.dll"
PHPIniDir C:/PHP

#First option - only php files
#<FilesMatch \.php


这篇关于我如何解决错误消息“你的php安装似乎缺少wordpress所需的mysql扩展。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆