dongzhilian0188 2013-03-04 02:16
浏览 62
已采纳

我可以使用PEAR在Web应用程序中包含模块吗?

I am creating a web app in LAMP. It was a while since I last created anything in PHP and back then I wasn't familiar with things like package managing and version control. I'm going to use MySQL in my app so I found the abstraction layer module MDB2 in PEAR.

My previous experiences tell me that I should be able to fetch the module to a lib/ subdirectory in my development repo, so that it will be present with every clone of the repo. But PEAR installs to /usr/share/php.

Can I make PEAR fetch to my development repo?

Or am I taking the wrong approach? My base problem is how to include a PHP module in the app that I'm creating.

  • 写回答

1条回答 默认 最新

  • dongmu7335 2013-03-04 08:53
    关注

    You can configure PEAR to install into any directory you want, with a custom configuration file:

    $ pear config-create lib pear.cfg
    

    Now you need to tell the pear installer to use the config file:

    $ pear -c pear.cfg install mdb2
    

    That's all.


    Btw, I recommend to use PDO as database layer if you don't need deep abstraction.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?