Bug 214177

Summary: PHP can connect to PostgreSQL from CLI but not from Apache
Product: [Fedora] Fedora Reporter: Tamal Kanti Nath <tamal.nath>
Component: phpAssignee: Joe Orton <jorton>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-11-06 13:21:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
php.ini
none
pg_hba.conf
none
httpd.conf
none
The script where I face the problem none

Description Tamal Kanti Nath 2006-11-06 13:03:28 UTC
Description of problem:
PHP can connect to PostgreSQL from CLI but not from Apache.

Version-Release number of selected component (if applicable):
php-5.1.6-3
httpd-2.2.3-5
postgresql-server-8.1.4-1.1
php-pgsql-5.1.6-3

How reproducible:
Create a rele in PostgreSQL and configure the pg_hba.conf file. Configure
php.ini to show the errors in the browser.

Steps to Reproduce:
1.
2.
3.
  
Actual results:
Warning: pg_connect() [function.pg-connect.html]: Unable to connect to
PostgreSQL server: could not connect to server: Permission denied Is the server
running on host "localhost" and accepting TCP/IP connections on port 5432? in
/home/tamal/public_html/pgsql.php on line 12

Expected results:
<table border>
	<tr>
		<td>2006-11-06</td>
	</tr>
</table>

Additional info:

Comment 1 Tamal Kanti Nath 2006-11-06 13:03:28 UTC
Created attachment 140460 [details]
php.ini

Comment 2 Tamal Kanti Nath 2006-11-06 13:04:40 UTC
Created attachment 140461 [details]
pg_hba.conf

Comment 3 Tamal Kanti Nath 2006-11-06 13:05:51 UTC
Created attachment 140462 [details]
httpd.conf

Comment 4 Tamal Kanti Nath 2006-11-06 13:14:27 UTC
Created attachment 140465 [details]
The script where I face the problem

Comment 5 Joe Orton 2006-11-06 13:21:37 UTC
Please try:

# setsebool -P httpd_can_network_connect 1