php socket script works on linux shell but not on browser ?

Dear Experts,
After root login, I set  access right for non-root users using socket on php script as following command:

    setcap 'cap_net_raw=+ep' /usr/local/bin/php

And then run the command at linux shell:

    otheruser#php socket-example-1.php

It works without any previous permission error, but I tried run it on browser that doesn't work, so which setting in php.ini I need to set for that ? And I run phpinfo() on browser and see Socket Support is enabled, why it is still not working ?

I tried on php.ini  with uncomment  or comment extension=php_sockets.dll or for window and linux both don't work but socket is still enabled from phpinfo() output on browser. So which setting for enabling socket on php for linux shell and browser ?

(Note: this link describes the socket is enabled with compiling with configuration option during installation ,

 Please adivse
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It could be selinux or apparmor blocking sockets coming from httpd.
rwniceingAuthor Commented:
I am using Linux CentOS6 apache, what is selinux using for ? Please advise
Install policycoreutils-python
then run audit-allow -a
it will show you variables to modify (setsebool -p variable true) to allow apache to connect using tcp. (Default is to deny)
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

rwniceingAuthor Commented:
root@vps [~]# audit2allow -a
unable to open /etc/selinux/targeted/policy/policy.-1:  No such file or directory

root@vps [~]# setsebool -p variable true
setsebool:  SELinux is disabled.

How to enable SELinux ? Please advise
Selinux is disabled. Something else is at fault.
Do you use mod_php or php-cgi ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rwniceingAuthor Commented:
Is it related to my VPS account  with my hosting company ?

 When follow to this link at
to enable Selinux

But I could NOT have /etc/selinux/config     file

there only have this
root@vps [/etc/selinux]# ls
./  ../  restorecond.conf  restorecond_user.conf  semanage.conf

I need to care this config file ?

Where can I check
Do you use mod_php or php-cgi ?

Please advise
rwniceingAuthor Commented:
after comment  extension=php_sockets.dll with ";" in /etc/lib/php.ini, and reboot the server,

audit2allow -a is still not working

root@vps [/etc/selinux]# audit2allow -a
unable to open /etc/selinux/targeted/policy/policy.-1:  No such file or directory
Instructions are for RHEL5, you need to install selinux-policy-targeted fro them to work.
If you enable selinux their way it will log all violations of policy instead of denying

Can you check "gentenforce" and "sestatus"? If either equals zero - selinux does not protect your system and no need to diagnose it.

first block in phpinfo() usually tells how PHP was activated.
rwniceingAuthor Commented:
I followed the instruction from  "installation selinux linux CENTOS6 "  searched in google that should be okay
for installation, and then follow the wrong link for RedL5 to enable selinux.

Do I need to re-install selinux again ?

root@vps [/etc/selinux]# sestatus
SELinux status:                 disabled

root@vps [/etc/selinux]# gentenforce
-bash: gentenforce: command not found

root@vps [/etc/selinux]# uname -a
Linux 2.6.32-042stab092.1 #1 SMP Tue Jun 24 09:10:28 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux

my phpinfo() output on browser
PHP Version 5.3.21

System	Linux 2.6.32-042stab092.1 #1 SMP Tue Jun 24 09:10:28 MSK 2014 x86_64
Build Date	Feb 4 2013 12:35:34
Configure Command	'./configure' '--disable-fileinfo' '--disable-phar' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-magic-quotes' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-wddx' '--enable-zend-multibyte' '--enable-zip' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic' '--with-png-dir=/usr' '--with-pspell' '--with-sqlite=shared' '--with-tidy=/opt/tidy/' '--with-xmlrpc' '--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-dir=/usr'
Server API	Apache 2.0 Handler
Virtual Directory Support	disabled
Configuration File (php.ini) Path	/usr/local/lib
Loaded Configuration File	/usr/local/lib/php.ini
Scan this dir for additional .ini files	(none)
Additional .ini files parsed	(none)
PHP API	20090626
PHP Extension	20090626
Zend Extension	220090626
Zend Extension Build	API220090626,NTS
PHP Extension Build	API20090626,NTS
Debug Build	no
Thread Safety	disabled
Zend Memory Manager	enabled
Zend Multibyte Support	enabled
IPv6 Support	enabled
Registered PHP Streams	compress.zlib, compress.bzip2, dict, ftp, ftps, gopher, http, https, imap, imaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp, php, file, glob, data, zip
Registered Stream Socket Transports	tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters	zlib.*, bzip2.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

Zend logo This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

PHP Credits



Apache Version	Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_bwlimited/1.4 PHP/5.3.21
Apache API Version	20051115
Server Administrator
User/Group	nobody(99)/99
Max Requests	Per Child: 10000 - Keep Alive: on - Max Per Connection: 100
Timeouts	Connection: 300 - Keep-Alive: 5
Virtual Server	Yes
Server Root	/usr/local/apache
Loaded Modules	core mod_authn_file mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_default mod_auth_basic mod_include mod_filter mod_deflate mod_log_config mod_logio mod_env mod_expires mod_headers mod_unique_id mod_setenvif mod_version mod_ssl prefork http_core mod_mime mod_status mod_autoindex mod_asis mod_info mod_suexec mod_cgi mod_negotiation mod_dir mod_actions mod_userdir mod_alias mod_rewrite mod_so mod_fastinclude mod_bwlimited mod_ruid2 mod_php5

Directive	Local Value	Master Value
engine	1	1
last_modified	0	0
xbithack	0	0

Apache Environment

Variable	Value
SCRIPT_URL	/data/php/phpinfo.php
HTTP_ACCEPT	text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_USER_AGENT	Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36
HTTP_ACCEPT_ENCODING	gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE	en-US,en;q=0.8,zh-TW;q=0.6,zh;q=0.4
HTTP_COOKIE	PHPSESSID=f8815796b9cff537949d6005702cfc82
PATH	/sbin:/usr/sbin:/bin:/usr/bin
SERVER_SIGNATURE	<address>Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_bwlimited/1.4 PHP/5.3.21 Server at Port 80</address>
SERVER_SOFTWARE	Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_bwlimited/1.4 PHP/5.3.21
DOCUMENT_ROOT	/home/mysite/public_html
SCRIPT_FILENAME	/home/mysite/public_html/data/php/phpinfo.php
REQUEST_URI	/data/php/phpinfo.php
SCRIPT_NAME	/data/php/phpinfo.php

HTTP Headers Information

HTTP Request Headers
HTTP Request	GET /data/php/phpinfo.php HTTP/1.1
Connection	keep-alive
Accept	text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent	Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36
Accept-Encoding	gzip,deflate,sdch
Accept-Language	en-US,en;q=0.8,zh-TW;q=0.6,zh;q=0.4
Cookie	PHPSESSID=f8815796b9cff537949d6005702cfc82
HTTP Response Headers
X-Powered-By	PHP/5.3.21
Keep-Alive	timeout=5, max=100
Connection	Keep-Alive
Transfer-Encoding	chunked
Content-Type	text/html


APC Support	enabled
Version	3.1.13
APC Debugging	Disabled
MMAP Support	Enabled
MMAP File Mask	no value
Locking type	pthread read/write Locks
Serialization Support	php
Revision	$Revision: 327136 $
Build Date	Feb 4 2013 12:46:33

Directive	Local Value	Master Value
apc.cache_by_default	On	On
apc.canonicalize	On	On
apc.coredump_unmap	Off	Off
apc.enable_cli	Off	Off
apc.enabled	On	On
apc.file_md5	Off	Off
apc.file_update_protection	2	2
apc.filters	no value	no value
apc.gc_ttl	3600	3600
apc.include_once_override	Off	Off
apc.lazy_classes	Off	Off
apc.lazy_functions	Off	Off
apc.max_file_size	1M	1M
apc.mmap_file_mask	no value	no value
apc.num_files_hint	1000	1000
apc.preload_path	no value	no value
apc.report_autofilter	Off	Off
apc.rfc1867	Off	Off
apc.rfc1867_freq	0	0
apc.rfc1867_prefix	upload_	upload_
apc.rfc1867_ttl	3600	3600
apc.serializer	default	default
apc.shm_segments	1	1
apc.shm_size	32M	32M
apc.slam_defense	On	On
apc.stat	On	On
apc.stat_ctime	Off	Off
apc.ttl	0	0
apc.use_request_time	On	On
apc.user_entries_hint	4096	4096
apc.user_ttl	0	0
apc.write_lock	On	On


BCMath support	enabled

Directive	Local Value	Master Value
bcmath.scale	0	0


BZip2 Support	Enabled
Stream Wrapper support	compress.bzip2://
Stream Filter support	bzip2.decompress, bzip2.compress
BZip2 Version	1.0.5, 10-Dec-2007


Calendar support	enabled


PHP Version	5.3.21

Directive	Local Value	Master Value
allow_call_time_pass_reference	On	On
allow_url_fopen	On	On
allow_url_include	Off	Off
always_populate_raw_post_data	Off	Off
arg_separator.input	&	&
arg_separator.output	&	&
asp_tags	Off	Off
auto_append_file	no value	no value
auto_globals_jit	On	On
auto_prepend_file	no value	no value
browscap	no value	no value
default_charset	no value	no value
default_mimetype	text/html	text/html
define_syslog_variables	Off	Off
detect_unicode	On	On
disable_classes	no value	no value
disable_functions	no value	no value
display_errors	On	On
display_startup_errors	Off	Off
doc_root	no value	no value
docref_ext	no value	no value
docref_root	no value	no value
enable_dl	On	On
error_append_string	no value	no value
error_log	error_log	error_log
error_prepend_string	no value	no value
error_reporting	22519	22519
exit_on_timeout	Off	Off
expose_php	On	On
extension_dir	/usr/local/lib/php/extensions/no-debug-non-zts-20090626	/usr/local/lib/php/extensions/no-debug-non-zts-20090626
file_uploads	On	On	#FFFFFF	#FFFFFF
highlight.comment	#FF8000	#FF8000
highlight.default	#0000BB	#0000BB
highlight.html	#000000	#000000
highlight.keyword	#007700	#007700
highlight.string	#DD0000	#DD0000
html_errors	On	On
ignore_repeated_errors	Off	Off
ignore_repeated_source	Off	Off
ignore_user_abort	Off	Off
implicit_flush	Off	Off
include_path	.:/usr/lib/php:/usr/local/lib/php	.:/usr/lib/php:/usr/local/lib/php
log_errors	On	On
log_errors_max_len	1024	1024
magic_quotes_gpc	On	On
magic_quotes_runtime	Off	Off
magic_quotes_sybase	Off	Off
mail.add_x_header	Off	Off
mail.force_extra_parameters	no value	no value
mail.log	no value	no value
max_execution_time	30	30
max_file_uploads	20	20
max_input_nesting_level	64	64
max_input_time	60	60
max_input_vars	1000	1000
memory_limit	1532M	1532M
open_basedir	no value	no value
output_buffering	no value	no value
output_handler	no value	no value
post_max_size	8M	8M
precision	12	12
realpath_cache_size	16K	16K
realpath_cache_ttl	120	120
register_argc_argv	On	On
register_globals	Off	Off
register_long_arrays	On	On
report_memleaks	On	On
report_zend_debug	On	On
request_order	no value	no value
safe_mode	Off	Off
safe_mode_exec_dir	/usr/local/php/bin	/usr/local/php/bin
safe_mode_gid	Off	Off
safe_mode_include_dir	no value	no value
sendmail_from	no value	no value
sendmail_path	/usr/sbin/sendmail -t -i	/usr/sbin/sendmail -t -i
serialize_precision	100	100
short_open_tag	On	On
SMTP	localhost	localhost
smtp_port	25	25
sql.safe_mode	Off	Off
track_errors	Off	Off
unserialize_callback_func	no value	no value
upload_max_filesize	6M	6M
upload_tmp_dir	no value	no value
user_dir	no value	no value
user_ini.cache_ttl	300	300
user_ini.filename	.user.ini	.user.ini
variables_order	EGPCS	EGPCS
xmlrpc_error_number	0	0
xmlrpc_errors	Off	Off
y2k_compliance	On	On
zend.enable_gc	On	On


ctype functions	enabled


cURL support	enabled
cURL Information	7.24.0
Age	3
AsynchDNS	No
Debug	No
GSS-Negotiate	No
IPv6	Yes
Largefile	Yes
krb4	No
libz	Yes
CharConv	No
Protocols	dict, file, ftp, ftps, gopher, http, https, imap, imaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp
Host	x86_64-unknown-linux-gnu
SSL Version	OpenSSL/1.0.0
ZLib Version	1.2.3


date/time support	enabled
"Olson" Timezone Database Version	2012.10
Timezone Database	internal
Default timezone	Asia/Hong_Kong

Directive	Local Value	Master Value
date.default_latitude	31.7667	31.7667
date.default_longitude	35.2333	35.2333
date.sunrise_zenith	90.583333	90.583333
date.sunset_zenith	90.583333	90.583333
date.timezone	Asia/Hong_Kong	Asia/Hong_Kong


DOM/XML	enabled
DOM/XML API Version	20031129
libxml Version	2.9.0
HTML Support	enabled
XPath Support	enabled
XPointer Support	enabled
Schema Support	enabled
RelaxNG Support	enabled


eAccelerator support	enabled
Caching Enabled	true
Optimizer Enabled	true
Check mtime Enabled	true
Memory Size	16,777,144 Bytes
Memory Available	16,765,848 Bytes
Memory Allocated	11,296 Bytes
Cached Scripts	2
Removed Scripts	0

Directive	Local Value	Master Value
eaccelerator.allowed_admin_path	no value	no value
eaccelerator.cache_dir	/tmp/eaccelerator	/tmp/eaccelerator
eaccelerator.check_mtime	1	1
eaccelerator.debug	0	0
eaccelerator.enable	1	1
eaccelerator.filter	no value	no value
eaccelerator.log_file	no value	no value
eaccelerator.optimizer	1	1
eaccelerator.shm_max	0	0
eaccelerator.shm_only	0	0
eaccelerator.shm_prune_period	0	0
eaccelerator.shm_size	16	16
eaccelerator.shm_ttl	0	0


Regex Library	Bundled library enabled


EXIF Support	enabled
EXIF Version	1.4 $Id$
Supported EXIF Version	0220
Supported filetypes	JPEG,TIFF

Directive	Local Value	Master Value
exif.decode_jis_intel	JIS	JIS
exif.decode_jis_motorola	JIS	JIS
exif.decode_unicode_intel	UCS-2LE	UCS-2LE
exif.decode_unicode_motorola	UCS-2BE	UCS-2BE
exif.encode_jis	no value	no value
exif.encode_unicode	ISO-8859-15	ISO-8859-15


Input Validation and Filtering	enabled
Revision	$Id: 209a1c3c98c04a5474846e7bbe8ca72054ccfd4f $

Directive	Local Value	Master Value
filter.default	unsafe_raw	unsafe_raw
filter.default_flags	no value	no value


FTP support	enabled


GD Support	enabled
GD Version	bundled (2.0.34 compatible)
FreeType Support	enabled
FreeType Linkage	with freetype
FreeType Version	2.3.11
GIF Read Support	enabled
GIF Create Support	enabled
JPEG Support	enabled
libJPEG Version	6b
PNG Support	enabled
libPNG Version	1.2.49
WBMP Support	enabled
XPM Support	enabled
libXpm Version	30411
XBM Support	enabled

Directive	Local Value	Master Value
gd.jpeg_ignore_warning	0	0


GetText Support	enabled


hash support	enabled
Hashing Engines	md2 md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru snefru256 gost adler32 crc32 crc32b salsa10 salsa20 haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5


iconv support	enabled
iconv implementation	glibc
iconv library version	2.12

Directive	Local Value	Master Value
iconv.input_encoding	ISO-8859-1	ISO-8859-1
iconv.internal_encoding	ISO-8859-1	ISO-8859-1
iconv.output_encoding	ISO-8859-1	ISO-8859-1


IMAP c-Client Version	2007f
SSL Support	enabled
Kerberos Support	enabled


json support	enabled
json version	1.2.1


libXML support	active
libXML Compiled Version	2.9.0
libXML Loaded Version	20900
libXML streams	enabled


Multibyte Support	enabled
Multibyte string engine	libmbfl
HTTP input encoding translation	disabled

mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

Multibyte (japanese) regex support	enabled
Multibyte regex (oniguruma) backtrack check	On
Multibyte regex (oniguruma) version	4.7.1

Directive	Local Value	Master Value
mbstring.detect_order	no value	no value
mbstring.encoding_translation	Off	Off
mbstring.func_overload	0	0
mbstring.http_input	pass	pass
mbstring.http_output	pass	pass
mbstring.http_output_conv_mimetypes	^(text/|application/xhtml\+xml)	^(text/|application/xhtml\+xml)
mbstring.internal_encoding	no value	no value
mbstring.language	neutral	neutral
mbstring.script_encoding	no value	no value
mbstring.strict_detection	Off	Off
mbstring.substitute_character	no value	no value


mcrypt support	enabled
mcrypt_filter support	enabled
Version	2.5.8
Api No	20021217
Supported ciphers	cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes	cbc cfb ctr ecb ncfb nofb ofb stream

Directive	Local Value	Master Value
mcrypt.algorithms_dir	no value	no value
mcrypt.modes_dir	no value	no value


memcache support	enabled
Active persistent connections	0
Version	2.2.7
Revision	$Revision: 327750 $

Directive	Local Value	Master Value
memcache.allow_failover	1	1
memcache.chunk_size	8192	8192
memcache.default_port	11211	11211
memcache.default_timeout_ms	1000	1000
memcache.hash_function	crc32	crc32
memcache.hash_strategy	standard	standard
memcache.max_failover_attempts	20	20


MySQL Support	enabled
Active Persistent Links	0
Active Links	0
Client API version	5.1.68
MYSQL_SOCKET	/var/lib/mysql/mysql.sock
MYSQL_INCLUDE	-I/usr/include/mysql
MYSQL_LIBS	-L/usr/lib64 -lmysqlclient

Directive	Local Value	Master Value
mysql.allow_local_infile	On	On
mysql.allow_persistent	On	On
mysql.connect_timeout	60	60
mysql.default_host	no value	no value
mysql.default_password	no value	no value
mysql.default_port	no value	no value
mysql.default_socket	/var/lib/mysql/mysql.sock	/var/lib/mysql/mysql.sock
mysql.default_user	no value	no value
mysql.max_links	Unlimited	Unlimited
mysql.max_persistent	Unlimited	Unlimited
mysql.trace_mode	Off	Off


MysqlI Support	enabled
Client API library version	5.1.68
Active Persistent Links	0
Inactive Persistent Links	0
Active Links	0
Client API header version	5.1.66
MYSQLI_SOCKET	/var/lib/mysql/mysql.sock

Directive	Local Value	Master Value
mysqli.allow_local_infile	On	On
mysqli.allow_persistent	On	On
mysqli.default_host	no value	no value
mysqli.default_port	3306	3306
mysqli.default_pw	no value	no value
mysqli.default_socket	/var/lib/mysql/mysql.sock	/var/lib/mysql/mysql.sock
mysqli.default_user	no value	no value
mysqli.max_links	Unlimited	Unlimited
mysqli.max_persistent	Unlimited	Unlimited
mysqli.reconnect	Off	Off


OpenSSL support	enabled
OpenSSL Library Version	OpenSSL 1.0.0-fips 29 Mar 2010
OpenSSL Header Version	OpenSSL 1.0.0-fips 29 Mar 2010


PCRE (Perl Compatible Regular Expressions) Support	enabled
PCRE Library Version	8.21 2011-12-12

Directive	Local Value	Master Value
pcre.backtrack_limit	1000000	1000000
pcre.recursion_limit	100000	100000


PDO support	enabled
PDO drivers	sqlite, sqlite2, mysql


PDO Driver for MySQL	enabled
Client API version	5.1.68

Directive	Local Value	Master Value
pdo_mysql.default_socket	/var/lib/mysql/mysql.sock	/var/lib/mysql/mysql.sock


PDO Driver for SQLite 3.x	enabled
SQLite Library


Revision	$Id: 5a2da3946b96c5afbf3aff8db8a8681f8bedee85 $


PSpell Support	enabled


Reflection	enabled
Version	$Id: 4af6c4c676864b1c0bfa693845af0688645c37cf $


Session Support	enabled
Registered save handlers	files user sqlite memcache
Registered serializer handlers	php php_binary wddx

Directive	Local Value	Master Value
session.auto_start	Off	Off
session.bug_compat_42	On	On
session.bug_compat_warn	On	On
session.cache_expire	180	180
session.cache_limiter	nocache	nocache
session.cookie_domain	no value	no value
session.cookie_httponly	Off	Off
session.cookie_lifetime	0	0
session.cookie_path	/	/
session.cookie_secure	Off	Off
session.entropy_file	no value	no value
session.entropy_length	0	0
session.gc_divisor	100	100
session.gc_maxlifetime	1440	1440
session.gc_probability	1	1
session.hash_bits_per_character	4	4
session.hash_function	0	0	PHPSESSID	PHPSESSID
session.referer_check	no value	no value
session.save_handler	files	files
session.save_path	/tmp	/tmp
session.serialize_handler	php	php
session.use_cookies	On	On
session.use_only_cookies	On	On
session.use_trans_sid	0	0


Simplexml support	enabled
Revision	$Id: 02ab7893b36d51e9c59da77d7e287eb3b35e1e32 $
Schema support	enabled


Soap Client	enabled
Soap Server	enabled

Directive	Local Value	Master Value
soap.wsdl_cache	1	1
soap.wsdl_cache_dir	/tmp	/tmp
soap.wsdl_cache_enabled	1	1
soap.wsdl_cache_limit	5	5
soap.wsdl_cache_ttl	86400	86400


Sockets Support	enabled


SPL support	enabled
Interfaces	Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
Classes	AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException


SQLite support	enabled
PECL Module version	2.0-dev $Id$
SQLite Library	2.8.17
SQLite Encoding	iso8859

Directive	Local Value	Master Value
sqlite.assoc_case	0	0


SQLite3 support	enabled
SQLite3 module version	0.7-dev
SQLite Library

Directive	Local Value	Master Value
sqlite3.extension_dir	no value	no value


Dynamic Library Support	enabled
Path to sendmail	/usr/sbin/sendmail -t -i

Directive	Local Value	Master Value	1	1
assert.bail	0	0
assert.callback	no value	no value
assert.quiet_eval	0	0
assert.warning	1	1
auto_detect_line_endings	0	0
default_socket_timeout	60	60
from	no value	no value
safe_mode_allowed_env_vars	PHP_	PHP_
safe_mode_protected_env_vars	LD_LIBRARY_PATH	LD_LIBRARY_PATH
url_rewriter.tags	a=href,area=href,frame=src,input=src,form=,fieldset=	a=href,area=href,frame=src,input=src,form=,fieldset=
user_agent	no value	no value


Tidy support	enabled
libTidy Release	25 March 2009
Extension Version	2.0 ($Id$)

Directive	Local Value	Master Value
tidy.clean_output	0	0
tidy.default_config	no value	no value


Tokenizer Support	enabled


WDDX Support	enabled
WDDX Session Serializer	enabled


XML Support	active
XML Namespace Support	active
EXPAT Version	expat_2.0.1


XMLReader	enabled


core library version	xmlrpc-epi v. 0.51
php extension version	0.51
author	Dan Libby
open sourced by


XMLWriter	enabled


XSL	enabled
libxslt Version	1.1.27
libxslt compiled against libxml Version	2.9.0
EXSLT	enabled
libexslt Version	1.1.27

Zend Guard Loader

Zend Guard Loader	enabled
License Path	no value
Obfuscation level	3


Zip	enabled
Extension Version	$Id: bdd35a2ede0347a3df239de1e7dc5d7e588f00c3 $
Zip version	1.11.0
Libzip version	0.10.1


ZLib Support	enabled
Stream Wrapper support	compress.zlib://
Stream Filter support	zlib.inflate, zlib.deflate
Compiled Version	1.2.3
Linked Version	1.2.3

Directive	Local Value	Master Value
zlib.output_compression	Off	Off
zlib.output_compression_level	-1	-1
zlib.output_handler	no value	no value

Additional Modules

Module Name
ionCube Loader


Variable	Value
TERM	linux
LD_LIBRARY_PATH	/usr/local/apache/lib
PATH	/sbin:/usr/sbin:/bin:/usr/bin
runlevel	3
previous	N
_	/usr/local/apache/bin/httpd

PHP Variables

Variable	Value
_REQUEST["PHPSESSID"]	f8815796b9cff537949d6005702cfc82
_COOKIE["PHPSESSID"]	f8815796b9cff537949d6005702cfc82
_SERVER["SCRIPT_URL"]	/data/php/phpinfo.php
_SERVER["HTTP_ACCEPT"]	text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
_SERVER["HTTP_USER_AGENT"]	Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36
_SERVER["HTTP_ACCEPT_ENCODING"]	gzip,deflate,sdch
_SERVER["HTTP_ACCEPT_LANGUAGE"]	en-US,en;q=0.8,zh-TW;q=0.6,zh;q=0.4
_SERVER["HTTP_COOKIE"]	PHPSESSID=f8815796b9cff537949d6005702cfc82
_SERVER["PATH"]	/sbin:/usr/sbin:/bin:/usr/bin
_SERVER["SERVER_SIGNATURE"]	<address>Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_bwlimited/1.4 PHP/5.3.21 Server at Port 80</address>
_SERVER["SERVER_SOFTWARE"]	Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_bwlimited/1.4 PHP/5.3.21
_SERVER["DOCUMENT_ROOT"]	/home/mysite/public_html
_SERVER["SCRIPT_FILENAME"]	/home/mysite/public_html/data/php/phpinfo.php
_SERVER["REQUEST_URI"]	/data/php/phpinfo.php
_SERVER["SCRIPT_NAME"]	/data/php/phpinfo.php
_SERVER["PHP_SELF"]	/data/php/phpinfo.php
_SERVER["REQUEST_TIME"]	1410430626
_SERVER["argc"]	0
_ENV["TERM"]	linux
_ENV["LD_LIBRARY_PATH"]	/usr/local/apache/lib
_ENV["PATH"]	/sbin:/usr/sbin:/bin:/usr/bin
_ENV["runlevel"]	3
_ENV["PWD"]	/
_ENV["LANG"]	en_US.UTF-8
_ENV["previous"]	N
_ENV["_"]	/usr/local/apache/bin/httpd

PHP License

This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact

Open in new window

Please get hold of CentOS's PHP and get rid of backyard build you have there.
nobody ever can support such PHP you have there.
rwniceingAuthor Commented:
which file sentence you find that on phpinfo output ?

How to remove it ? I think it is done  from my hosting company  ?
rwniceingAuthor Commented:
I am using mod_php5  at the last word of the following code

Loaded Modules	core mod_authn_file mod_authn_default mod_authz_host mod_authz_groupfile mod_authz_user mod_authz_default mod_auth_basic mod_include mod_filter mod_deflate mod_log_config mod_logio mod_env mod_expires mod_headers mod_unique_id mod_setenvif mod_version mod_ssl prefork http_core mod_mime mod_status mod_autoindex mod_asis mod_info mod_suexec mod_cgi mod_negotiation mod_dir mod_actions mod_userdir mod_alias mod_rewrite mod_so mod_fastinclude mod_bwlimited mod_ruid2 mod_php5

Open in new window

rwniceingAuthor Commented:
Could you explain more what you mean as follows  ? Thanks

Please get hold of CentOS's PHP and get rid of backyard build you have there.
nobody ever can support such PHP you have there.
rwniceingAuthor Commented:
Finslly ,Now I've install  selinux-policy-targeted, config file  and targeted/ is existed now.

Could you explain more about this as follows  before I enabel selinux ?
The enabling selinux will damage some where on my system ?

Instructions are for RHEL5, you need to install selinux-policy-targeted fro them to work.
If you enable selinux their way it will log all violations of policy instead of denying
You need to ask your hosting company. Your system image is so far from CentOS that it is hard to cope with it.
On generic CentOS system SELinux is enabled by default and denies PHP socket connections.
You dont have selinux enabled(or if it is enabled you have incomplete tooling for it, so you cannot check whatsup), nor you have centos PHP.
Let this Q hang around a bit, it takes day round for all experts interested to see it.
Enable selinux: make sure you set /etc/sysconfig/selinux to permissive where it says "enforcing"
Enable restorecond and auditd services
And do autorelabel as in your hoster's guide/
rwniceingAuthor Commented:
before doing that just make sure what you said

my linux is linux distribution version , CentOS6 which is installed from my VPS hosting company.

What you mean is the  original CENTOS with Selinux is enabled by default and will deny PHP socket
connection so that I can not run php socket in php script on linux shell and browser.

Now selinux is disabled so that I can run the php socket on linux shell but can't run it on browser becoz of
selinux is disabled

Please advise
When you said the script doesn't work in the browser, what happens? Do you get an error? Do you have error logging or reporting turned on so you can capture the error (in case you don't get an error message)?
rwniceingAuthor Commented:
just echo my message I made  or set in php script  that is "socket is not created" on browser , and echo "socket is created" on linux shell

And on the apache log ,  it seem http 200 is okay and no any issue but I don't know what is 992 - - [11/Sep/2014:22:32:08 +0800] "GET /tools/tcpip/ping.php HTTP/1.1" 200 912 "" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36"

Be reminded, on linux shell run "php ping.php" that is working  at root access or non-root account after setcap 'cap_net_raw=+ep' /usr/local/bin/php

Now  i'm trying this link instruction at for enabling selinux
When PHP is called in apache it is either php-cgi or apache httpd.
I dont thing you want universal raw socket capability on later.
912 is the size of the output in bytes.

You can have more than one PHP installation on a system. There's a chance that running the version on the command line has the capability to run the script, while the Apache module is using a separate version.

Can you post your PHP code? Echoing your custom message does not give information about why it failed. You should turn on PHP's error reporting / display / logging so you can see the actual reason it's failing.
Raw sockets are root-only (or more accurately can be added as capability to others), for good reason.
rwniceingAuthor Commented:
gr8gonzo, here it is,

on the browser message
socket_create() failed: reason: Operation not permitted
$socket = socket_create(AF_INET, SOCK_RAW, 1);
	if ($socket === false) {
    echo "socket_create() failed: reason: " . socket_strerror(socket_last_error()) . "<br/>\n";
} else {
    echo "OK.\n";

Open in new window

Apache module  for php, you mean it is called mod_php, right ? I also attached my phpinfo() information
on the previous posts. Please take a look it.
Since my VPS account was used before for Cpanel which is expired in last year, do you think it is issue ?
rwniceingAuthor Commented:
Thanks for all of your reply, it seems it is solved at

Please comment you agree it or not that hosting company has ability to restrict VPS users to enable Selinux
selinux does not run on OpenVZ host. It runs on guests just fine, like antivirus on windows guests....
rwniceingAuthor Commented:
Gheist, what is different btw running it on host and guest ? and any articles mention or describe it  on internet ? Please advise
me no wikipedia.... sorry
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.