Solved

editing the php source module

Posted on 2003-10-31
7
210 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
Comment Utility
<?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
Comment Utility
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
Comment Utility
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
Comment Utility
yes, I am still interested
0
 
LVL 14

Accepted Solution

by:
ThG earned 500 total points
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now