dqknycyt92288 2016-10-14 15:13
浏览 119
已采纳

使用composer创建cakephp项目并设置路径

I have Composer installed globally, So I open CMD and write the following command to create a project (composer create-project --prefer-dist cakephp/app my_app_name). What this does is install the project in my user folder. I need the project to be installed in wamp/www folder. And I can't for the life of me figure out how to set the path. Should I just cut-paste the project there or will that create issues with cakephp? still new to the framework :)

Any help would be appreciated. Thanks.

  • 写回答

1条回答 默认 最新

  • dongyang1518 2016-10-14 15:22
    关注

    Installing CakePHP

    Before starting you should make sure that you have got an up to date PHP version:

    php -v
    

    You should at least have got installed PHP 5.5.9 (CLI) or higher. Your webserver’s PHP version must also be of 5.5.9 or higher, and should best be the same version your command line interface (CLI) PHP version is of.

    Installing Composer

    CakePHP uses Composer, a dependency management tool, as the officially supported method for installation.

    Installing Composer on Linux and Mac OS X

    Run the installer script as described in the official Composer documentation and follow the instructions to install Composer.

    Execute the following command to move the composer.phar to a directory that is in your path:

    mv composer.phar /usr/local/bin/composer
    

    Installing Composer on Windows

    For Windows systems, you can download Composer’s Windows installer here. Further instructions for Composer’s Windows installer can be found within the README here.

    Create a CakePHP Project

    Now that you’ve downloaded and installed Composer, let’s say you want to create a new CakePHP application into my_app_name folder. For this just run the following composer command:

    php composer.phar create-project --prefer-dist cakephp/app my_app_name
    

    Or if Composer is installed globally:

     composer self-update && composer create-project --prefer-dist cakephp/app my_app_name
    

    Once Composer finishes downloading the application skeleton and the core CakePHP library, you should have a functioning CakePHP application installed via Composer. Be sure to keep the composer.json and composer.lock files with the rest of your source code.

    First point your composer to www folder.In my case i am using Xamp so pointed my composer to htdocs

     C:\xampp\htdocs>composer create-project --prefer-dist cakephp/app my_app_name
    
    Installing cakephp/app (3.3.2)
      - Installing cakephp/app (3.3.2)
        Downloading: 100%
    
    Created project in my_app_name
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.
    

    Updated

    I am using windows .

    C:\Users\Vision>cd\
    
    C:\>cd xampp
    
    C:\xampp>cd htdocs
    
    C:\xampp\htdocs>
    

    Also in windows if i right click on inside htdocs any folder i have option to use composer here

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

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。