學習使用簡單的php

來源:互聯網
上載者:User

標籤:

設定檔在:/etc/php5/$中,不同的模式含有自己的php.ini設定檔。php可以運行於多種模式:cgi、fastcgi、cli、web模組模式等4種;

 

我現在使用的模式是cli模式,這裡進行一次測試。

 

 

 

 

在ubuntu下需要安裝sudo apt-get install php5-dev

php應該是php5的連結。

 

修改config.m4檔案:

 

my.php檔案內容:

<?php$br = (php_sapi_name() == "cli")? "":"<br>";if(!extension_loaded(‘my‘)) {    dl(‘my.‘ . PHP_SHLIB_SUFFIX);}$module = ‘my‘;$functions = get_extension_funcs($module);echo "Functions available in the test extension:$br\n";foreach($functions as $func) {    echo $func."$br\n";}echo "$br\n";$function = ‘confirm_‘ . $module . ‘_compiled‘;if (extension_loaded($module)) {    $str = $function($module);} else {    $str = "Module $module is not compiled into PHP";}echo "$str\n";?>

 

my_test.php檔案內容:

<?php    echo confirm_my_compiled(‘testmerlin‘);?>

 

 

編輯/etc/php5/cli/php.ini檔案,添加一行:

 

測試:

[email protected]:~/swinstall/php-5.6.4/ext/my$ php my_test.php Congratulations! You have successfully modified ext/my/config.m4. Module testmerlin is now compiled into PHP.
[email protected]:~/swinstall/php-5.6.4/ext/my$

 

學習使用簡單的php

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.