viyancs
viyancs

Reputation: 2339

how to find php.ini in php5.3

i'm having a problem when i'm create socket program.

/* Get the port for the WWW service. */
$service_port = getservbyname('www', 'tcp');

/* Get the IP address for the target host. */
$address = gethostbyname('localhost');

/* Create a TCP/IP socket. */
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
------------------

when i'm run a program i'm get the error like this

1
Fatal error: Call to undefined function socket_create() in /opt/local/apache2/htdocs/php/TCPclient.php on line 14

i think that error because i'm not enable extension=php_sockets.dll

but when i try to locate php.ini i don't found php.ini i just found php.ini-development and php.ini-production, i change that file to enable extension=php_sockets.dll but when i'm try again to run my program i'm still get same error,

anyone know what is the problem ? i'm give the phpinfo of my local, i'm still worried with configuration file in phpinfo that is none , are that is missing? thanks for your answer. php info

Upvotes: 0

Views: 1451

Answers (4)

hakre
hakre

Reputation: 198249

I see two different things here:

  1. You think that extensions come in the .dll format. Actually that's windows. You are not running windows.

  2. You are running a UNIXoide system A common thing is next to have a single configuration file to also have folders with more configuration files in there, so that, if scanned recursively through all configuration directories this creates a multiple file based configuration database. Yeah! Rocks! But, the problem is, you have multiple things to check in your phpinfo (if you have not noticed so far):

    • Configuration File (php.ini) Path - This is the main configuration file configured.
    • Loaded Configuration File - This is the main configuration file actually loaded.
    • Scan this dir for additional .ini files - PHP looks here, too.
    • Additional .ini files parsed - Those have been actually loaded, too.

So take a decent look at all these settings and really, really take care to not mix things. PHP configuration is documented in the PHP Manual.

Check the documentation what an extension is, how you install it etc. pp. This varies depending on your system and software management.

Upvotes: 1

Shoan
Shoan

Reputation: 4078

It looks like you are running PHP on Mac OS. If this was installed using macports, run the following command

sudo port install php5-sockets

Upvotes: 2

dimirc
dimirc

Reputation: 6625

Since you are running on Mac you cannot use dlla. You can compile php with socket support or try Xampp

http://www.apachefriends.org/en/xampp-macosx.html

Upvotes: 0

jas-
jas-

Reputation: 1801

That is a pretty fair assumption. I am certain that because the php.ini is not found on your machine you have an installation problem.

What web server are you using? Are you installing Apache or using IIS for PHP support?

Your snapshot does not include the --enable-sockets option nor does it contain the loaded configuration file (php.ini).

Upvotes: 0

Related Questions