Solved

editing the php source module

Posted on 2003-10-31
7
240 Views
Last Modified: 2006-11-17
I need to know the following:

 

1.       How to add new function to php module

2.       In that function how to write to the http stream

3.       How to access data from sql recordset
0
Comment
Question by:buck2769
  • 2
  • 2
7 Comments
 
LVL 11

Expert Comment

by:shmert
ID: 9660984
<?php
// 1. How to add new function to php module
function myNewFunction() {
    // 2. In that function how to write to the http stream
    echo "This is being written to the HTTP response stream";
    // 3. How to access data from sql recordset
    $result = mysql_query("SELECT * FROM USER");
    while ($row = mysql_fetch_assoc($result)) {
        foreach ($row AS $key=>$value) echo "$key = $value <br />\n";
        echo "<hr />\n";
    }
}

?>
0
 
LVL 1

Author Comment

by:buck2769
ID: 10272818
Yes that would be how to do it inside a php file. Read the initial question and you will find that I want add a built in function inside of php. In other words I need to write C not PHP and then recompile PHP with my added enhancements. Thanks anyways.
0
 
LVL 14

Expert Comment

by:ThG
ID: 10275213
buck2769, are you still interested in this question? I can partially help you because I already edited php/zend source.
Otherwise I can delete this question and refund your points, let me know.
0
 
LVL 1

Author Comment

by:buck2769
ID: 10409695
yes, I am still interested
0
 
LVL 14

Accepted Solution

by:
ThG earned 500 total points
ID: 10425194
ok then..
first you should definitely read http://www.zend.com/apidoc/
this will give an interesting starting point.

After that, IIRC, you are going to need more information about the ext_skel tool, and you can find them in README.EXT_SKEL file, included in php distribution.

After that, you can start testing your new extension (note that everything in php is filed as "extension", but you can builtin it if you want, it's not necessarily a shared module).

In my experience, i found more help in ext/standard/, which contains all basic functions of PHP. There you can understand how the parameter passing works and all other internal things that are not covered in the apidoc manual.

For the sql handling of course watch in the proper extension (ext/mysql/) and so on.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question