П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 3519 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 6121 раз(а).

Учебник HTML.
Просмотров 3276 раз(а).

Руководство по PHP5.
Просмотров 5497 раз(а).

Хостинг через призму DNS.
Просмотров 4144 раз(а).

Подборка текстов стандартных документов.
Просмотров 55772 раз(а).

Учебник PHP - Самоучитель
Просмотров 3090 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 5699 раз(а).

Внешние атаки...
Просмотров 3840 раз(а).

Учебник PHP.
Просмотров 2825 раз(а).

SSI в примерах.
Просмотров 37462 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. Глава 46. Zend API: Hacking the Core of PHP След.

Using Extensions

Depending on the build process you selected, you should either end up with a new PHP binary to be linked into your Web server (or run as CGI), or with an .so (shared object) file. If you compiled the example file first_module.c as a shared object, your result file should be first_module.so. To use it, you first have to copy it to a place from which it's accessible to PHP. For a simple test procedure, you can copy it to your htdocs directory and try it with the source in Прим. 46-3. If you compiled it into the PHP binary, omit the call to dl(), as the module's functionality is instantly available to your scripts.

Внимание

For security reasons, you should not put your dynamic modules into publicly accessible directories. Even though it can be done and it simplifies testing, you should put them into a separate directory in production environments.

Пример 46-3. A test file for first_module.so.

<?php
    
// remove next comment if necessary
// dl("first_module.so");

$param = 2;
$return = first_module($param);

print(
"We sent '$param' and got '$return'");

?>

Calling this PHP file in your Web browser should give you the output shown in Рис. 46-2.

Рисунок 46-2. Output of first_module.php.

If required, the dynamic loadable module is loaded by calling the dl() function. This function looks for the specified shared object, loads it, and makes its functions available to PHP. The module exports the function first_module(), which accepts a single parameter, converts it to an integer, and returns the result of the conversion.

If you've gotten this far, congratulations! You just built your first extension to PHP.


Пред. Начало След.
Creating ExtensionsУровень выше Troubleshooting


Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru