検索
ホームページphp教程php手册PHP内核两大流程之启动PHP的核心代码段

PHP内核两大流程之启动PHP的核心代码段

Step 1: Start the sapi

extern zend_module_entry php_apache_module;

static int php_apache2_startup(sapi_module_struct *sapi_module)
{
        if (php_module_startup(sapi_module, &php_apache_module, 1)==FAILURE) {
                return FAILURE;
        }
        return SUCCESS;
}

Step 2: Start the php

int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_modules, uint num_additional_modules)
{
        zend_utility_functions zuf;
        zend_utility_values zuv;

	.....

	sapi_module = *sf;

	php_output_startup();

        zuf.error_function = php_error_cb;
        zuf.printf_function = php_printf;
        zuf.write_function = php_output_wrapper;
        zuf.fopen_function = php_fopen_wrapper_for_zend;
        zuf.message_handler = php_message_handler_for_zend;
        zuf.block_interruptions = sapi_module.block_interruptions;
        zuf.unblock_interruptions = sapi_module.unblock_interruptions;
        zuf.get_configuration_directive = php_get_configuration_directive_for_zend;
        zuf.ticks_function = php_run_ticks;
        zuf.on_timeout = php_on_timeout;
        zuf.stream_open_function = php_stream_open_for_zend;
        zuf.vspprintf_function = vspprintf;
        zuf.getenv_function = sapi_getenv;
        zuf.resolve_path_function = php_resolve_path_for_zend;
        zend_startup(&zuf, NULL TSRMLS_CC);

	......

	gc_globals_ctor(TSRMLS_C);

	......

        /* Register PHP core ini entries */
        REGISTER_INI_ENTRIES();

        /* Register Zend ini entries */
        zend_register_standard_ini_entries(TSRMLS_C);

        /* Disable realpath cache if an open_basedir is set */
        if (PG(open_basedir) && *PG(open_basedir)) {
                CWDG(realpath_cache_size_limit) = 0;
        }

        /* initialize stream wrappers registry
         * (this uses configuration parameters from php.ini)
         */
        if (php_init_stream_wrappers(module_number TSRMLS_CC) == FAILURE)       {
                php_printf("PHP:  Unable to initialize stream url wrappers.\n");
                return FAILURE;
        }

        /* startup extensions staticly compiled in */
        if (php_register_internal_extensions_func(TSRMLS_C) == FAILURE) {
                php_printf("Unable to start builtin modules\n");
                return FAILURE;
        }

        /* start additional PHP extensions */
        php_register_extensions_bc(additional_modules, num_additional_modules TSRMLS_CC);

        /* load and startup extensions compiled as shared objects (aka DLLs)
           as requested by php.ini entries
           theese are loaded after initialization of internal extensions
           as extensions *might* rely on things from ext/standard
           which is always an internal extension and to be initialized
           ahead of all other internals
         */
        php_ini_register_extensions(TSRMLS_C);
        zend_startup_modules(TSRMLS_C);

        /* start Zend extensions */
        zend_startup_extensions();

	.....
}

int zend_startup
(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC) /* {{{ */
{
        zend_compiler_globals *compiler_globals;
        zend_executor_globals *executor_globals;
	
	......

        zend_compile_file = compile_file;
        zend_execute_ex = execute_ex;
        zend_execute_internal = NULL;

        zend_init_opcodes_handlers();
	
	......
}

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

SublimeText3 英語版

SublimeText3 英語版

推奨: Win バージョン、コードプロンプトをサポート!

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

EditPlus 中国語クラック版

EditPlus 中国語クラック版

サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません

DVWA

DVWA

Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、