PHP extensions

Forum: System
Topic: PHP extensions
started by: pst

Posted by pst on Nov. 07 2005,03:33
First of all thanks for an excellent distro and a nice set of DSL extensions!

Now to my question...I need to use the socket functions in php. From what I can understand the php-4-monkey doesn't include any extensions.

So does that mean I have to build PHP from source and make my own DSL extension or can I "steal" the php extension ( from somewhere and copy it?



Posted by pst on Nov. 28 2005,13:32
To get extensions like socket functions working in php you need the correct entry in php.ini as well as the .so file.

I don't exactly know hot to roll my own dsl file even if I suspects it's only an archive file. So I did the quick and dirty version:

1. Find a file.

I found a file here:
< >
but I guess any file from a linux target system with a reasonalby close version number would have worked. The php version in php-4-monkey is 4.3.7

The file could be placed anywhere. I placed it in a new directory: /opt/php/ext

2. Make a php.ini file.

For php to find the sockets extension file or actually make any changes to the php config you need the php.ini file which isn't included in the php-4-monkey myDSL extension.

I placed the file in:

You can find exemples on the net or steal it somewhere else. I just made a minimal file which looks like this:

Code Sample


; Paths and Directories;

; UNIX: "/path1:/path2"  
;include_path = ".:/php/includes"
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues.  The alternate is to use the
; cgi.force_redirect configuration below
;doc_root =

; The directory under which PHP opens the script using /~usernamem used only
; if nonempty.
;user_dir =

; Directory in which the loadable extensions (modules) reside.
extension_dir = "/opt/php/ext"

; Dynamic Extensions;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;   extension=modulename.extension
; For example, on Windows:
;   extension=msql.dll
; ... or under UNIX:
; Note that it should be the name of the module only; no directory information
; needs to go here.  Specify the location of the extension with the
; extension_dir directive above.

3. Backup the files.

Add /opt/php/ext and /opt/php/lib/php.ini to your .filetool.lst file in /home/dsl.
This makes sure your files are gets saved (unless you have a full harddisk install of course).

Good luck!


Posted by pst on Nov. 28 2005,13:45
BTW, To check which options and php extensions you have make a php file with phpinfo().

Code Sample


It should now have a section like this:
Sockets Support    enabled

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.