cvs: /php4 README.SELF-CONTAINED-EXTENSIONS

From: Date: Tue, 02 May 2000 21:51:49 +0000
Subject: cvs: /php4 README.SELF-CONTAINED-EXTENSIONS
Groups: php.version4 
Request: Send a blank email to php-version4+get-14389@lists.php.net to get a copy of this message
sas Tue May 2 14:51:49 2000 EDT Modified files: /php4 README.SELF-CONTAINED-EXTENSIONS Log: Verbose "give the reader a quick success" tutorial Index: php4/README.SELF-CONTAINED-EXTENSIONS diff -u php4/README.SELF-CONTAINED-EXTENSIONS:1.1 php4/README.SELF-CONTAINED-EXTENSIONS:1.2 --- php4/README.SELF-CONTAINED-EXTENSIONS:1.1 Tue May 2 13:59:46 2000 +++ php4/README.SELF-CONTAINED-EXTENSIONS Tue May 2 14:51:48 2000 @@ -1,5 +1,7 @@ +$Id: README.SELF-CONTAINED-EXTENSIONS,v 1.2 2000/05/02 21:51:48 sas Exp $ +============================================================================= + HOW TO CREATE A SELF-CONTAINED PHP EXTENSION -$Id: README.SELF-CONTAINED-EXTENSIONS,v 1.1 2000/05/02 20:59:46 sas Exp $ A self-contained extension can be distributed independently of the PHP source. To create such an extension, three things are @@ -12,9 +14,42 @@ We will describe now how to create these and how to put things together. + +CONVERTING AN EXISTING EXTENSION + + Just to show you how easy it is to create a self-contained + extension, we will convert an embedded extension into a + self-contained one. Install PHP and execute the following + commands. + + $ mkdir /tmp/newext + $ cd /tmp/newext + + You now have an empty directory. We will copy the files from + the mysql extension: + + $ cp -rp php-4.0.X/ext/mysql/* . + + It is time to finish the module. Run: + + $ phpize + + You can now ship the contents of the directory - the extension + can live completely on its own. + + The user instructions boil down to + + $ ./configure \ + [--with-php-config=/path/to/php-config] \ + [--with-mysql=MYSQL-DIR] + $ make install + + The MySQL module will either use the embedded MySQL client + library or the MySQL installation in MYSQL-DIR. -SPECIFYING THE EXTENSION +DEFINING THE NEW EXTENSION + Our demo extension is called "foobar". It consists of two source files "foo.c" and "bar.c" @@ -83,24 +118,12 @@ configure from your config.m4. And that's it. You now have a self-contained extension. - - It can be installed by running: - $ ./configure [--with-php-config=/path/to/php-config] - $ make install +INSTALLING A SELF-CONTAINED EXTENSION -CONVERTING AN EXISTING EXTENSION + An extension can be installed by running: - If you want to distribute an extension from the PHP repository, copy - all files from the extension's directory to a new directory and - run phpize as described above. That's all! - - For example: - - $ dir=/tmp/new_moduke - $ cd php4/ext/mysql - $ mkdir $dir - $ cp -rp * $dir - $ cd $dir - $ phpize + $ ./configure \ + [--with-php-config=/path/to/php-config] + $ make install

« previous php.version4 (#14389) next »