Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: PHP extensions, Build my own DSL ext or ...< Next Oldest | Next Newest >
pst Offline





Group: Members
Posts: 9
Joined: Oct. 2005
Posted: Nov. 07 2005,03:33 QUOTE

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 (php_sockets.so) from somewhere and copy it?


Thanks,

Peter
Back to top
Profile PM 
pst Offline





Group: Members
Posts: 9
Joined: Oct. 2005
Posted: Nov. 28 2005,13:32 QUOTE

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 sockets.so file.

I found a sockets.so file here:
http://www.hardhathosting.com/community/forums/showthread.php?t=153
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:
/opt/php/lib

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

Code Sample

[PHP]


;;;;;;;;;;;;;;;;;;;;;;;;;
; 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:
;
;   extension=msql.so
;
; 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.


extension=sockets.so


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!

Best,
Peter
Back to top
Profile PM 
pst Offline





Group: Members
Posts: 9
Joined: Oct. 2005
Posted: Nov. 28 2005,13:45 QUOTE

BTW, To check which options and php extensions you have make a php file with phpinfo().

Code Sample

<html><body>
<?php
  phpinfo();  
?></body></html>


It should now have a section like this:
sockets
Sockets Support    enabled
Back to top
Profile PM 
2 replies since Nov. 07 2005,03:33 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: PHP extensions

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code