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

接着又出现了下面异常

 [Doctrine\DBAL\DBALException]                                                
  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 我的脚本在桌面

又出现了一下错误怎么办

  [Symfony\Component\Debug\Exception\ContextErrorException]                    
  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如下二维码:

 
 

 

 

 

    

 

转载于:https://www.cnblogs.com/Amos-Turing/p/6876984.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值