zoukankan      html  css  js  c++  java
  • centos下写Symfony

    之前都是在windows上写SY,现在要部署到Linux上了,提前测试一下。

    第一步,要有台Centos机器,安装过程略

    第二步,安装数据库,PostgreSQL,过程;

    第三步,安装版本控制器,GIT,过程:这个过程可以把你windows中的key转移到centos下就可以了;

    第四步,更新仓库里的代码:

    以下过程是代码运行时遇到的错误:

    1)更新代码第一步当然是安装composer;

    2)使用安装依赖 composer install

      我的centos7 自带的是php4 ,现在我要升级为5.6,很简单,如下

      sudo yum clean all
      sudo yum install -y php56w

      就这两个命令搞定。

      如果提示

    You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
    

     也好解决:执行

    yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring php56w-bcmath

    接着又出现了下面异常

     [DoctrineDBALDBALException]                                                
      The given 'driver' ] is unknown, Doctrine currently supports only the follo  
      wing drivers: pdo_mysql, pdo_sqlite, pdo_pgsql, pdo_oci, oci8, ibm_db2, pdo  
      _sqlsrv, mysqli, drizzle_pdo_mysql, sqlanywhere, sqlsrv   
    

     解决方法:

    找到这两个文件php.ini-development  and php.ini-production 将有关驱动的分号去掉

    这时候我要执行一个数据库脚本创建项目中的数据库怎么办?

    好办如下:

    [root@localhost ~]# su postgres 切换用户 
    bash-4.2$ psql
    could not change directory to "/root": Permission denied
    psql (9.5.6)
    Type "help" for help.
    
    postgres=# psql -Upostgres
    postgres-# psql -Upostgres</root/Desktop/db.sql 我的脚本在桌面

    又出现了一下错误怎么办

      [SymfonyComponentDebugExceptionContextErrorException]                    
      Warning: date_default_timezone_get(): It is not safe to rely on the system'  
      s timezone settings. You are *required* to use the date.timezone setting or  
       the date_default_timezone_set() function. In case you used any of those me  
      thods and you are still getting this warning, you most likely misspelled th  
      e timezone identifier. We selected the timezone 'UTC' for now, but please s  
      et date.timezone to select your timezone.                                    
                                                   
    
    修改php.ini文件,找到date.timezone= utc 就可以了
    

     这时候发现我机器上好像没有pdo_pgsql;

    有没有执行一个命令即可查看:php -m|grep -i pdo  

    如果没有就需要安装了,安装只需要执行:

    # yum install php56w-pgsql
    如果是php7 那么就写成  php71w-pgsql
    (56 ,71 分别代表 5.6 版本 ,7.1版本)


    现在的话你的项目就应该可以在centos 的开发环境下跑起来了,如果有页面找不到的情况
    你需要首先看看有没有大小写错误,如html的名称在windows上下小写的,引入可以运行,
    但在linux上市区分大小写的;
    好了如果有疑问可以加Symfony 技术讨论群:182983780;
    或者关注我的微信号whenDreams如下二维码:

    
    
    
    
    

        

  • 相关阅读:
    log4j学习
    数据库索引
    php 通过exec 创建git分支失败
    Nginx 常用全局变量 及Rewrite规则详解
    Jetbrains phpstorm pycharm 免费授权注册码
    Nginx return 关键字配置小技巧
    PHP 加密 和 解密 方法
    Nginx 禁用IP IP段
    Yii2 捕获错误日志
    transform 实现响应式绝对居中
  • 原文地址:https://www.cnblogs.com/Amos-Turing/p/6876984.html
Copyright © 2011-2022 走看看