环境:
H 111httpd-2.2
问题: Postgresql表数据回显在shell提示符中,但不在浏览器中。
Php代码:
$src="<html>\n<head>,\n<title>db test</title>\n</head>\n<body>\n<table>";
$dbc=pg_connect("host=localhost dbname=cricket user=cao password=cri123");
$dmq="select * from batsmen";
$result=pg_query($dbc, $dmq);
while($row=pg_fetch_assoc($result)){
$src.="\n<tr><td>".$row['id']."</td><td>".$row['name']."</td></tr>";
}
pg_clear_result($result);
pg_close($dbc);
src.="\n</table>\n</body>\n</html>";例如,shell提示符中的页面源代码:
<html>
<head><title>db test</title></head>
<body>
<table>
<tr><td>1</td><td>Broad man</td></tr>
<tr><td>2</td><td>Richards</td></tr>
<tr><td>3</td><td>Sachin</td></tr>
<tr><td>4</td><td>Lara</td></tr>
</table>
</body>
</html>但是,浏览器中的页面源代码:
<html>
<head><title>db test</title></head>
<body>
<table>
</table>
</body>
</html>即。只发送静态代码,但不向浏览器发送动态表数据。
发布于 2019-12-17 08:35:04
操作步骤:
s1: php httpd
s2: yum安装postgresql-服务器postgresql-cont肋骨
s3:
s4: service postgresql
systemctl启动postgresql
启用postgresql
服务postgresql重新启动
s5:编辑pg_hba.conf
..。
托管所有127.0.0.1/32 ident
所有主机::1/128 ident
..。
至
..。
托管所有127.0.0.1/32 md5
主机全部::1/128 md5
..。
S6:服务postgresql重新启动
s7:setsebool -P httpd_can_network_connect_db 1
https://stackoverflow.com/questions/59335825
复制相似问题