ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

icode9网站迁移到新服务器遇到的问题

2022-11-29 17:01:08  阅读:308  来源: 互联网

标签:icode9 语言  c++ 编写 函数 高级功能 编译器 错误代码


前两天把之前做的一些网站迁移到新服务器,没想到在本地打开没问题,到了新环境就出现了各种问题,下面把遇到问题的解决办法列出来,以后再遇到方便查阅。

1.我用的是wampserver集成开发环境,在新服务器上安装的时候,提示缺少几个.dll文件(msvcr140.dll、msvcr110.dll),然后就去搜索引擎搜,需要去微软官网下载几个文件,安装上就好了,注意,选择32位还是64位的时候,是根据wampserver看的,不是你的操作系统位数。

2.PHP版本比当时开发时的版本高,旧版本的一些语法在新版本中做了改变,比如,在使用一个变量时,这个变量必须有值,旧版本中就不需要,解决办法是用isset()方法判断一下有没有定义,我遇到的是,预定义一个常量,保存系统变量$_SERVER[HTTP_REFERER](上一页的URL),在第一次打开网站时,是没有上一页的,所以会报notice警告,这时用isset()判断一下$_SERVER[HTTP_REFERER]存不存在就可以了。

3.还有一个问题也是因为php版本导致的警告,PHP5.3以上默认只能传递具体的变量,而不能通过函数返回值传递。

PHPPHP
PHP
1 2 3 4 5 6 7 8 //增删改模型 protected function aud ( $_sql ) { $_db = DB:: getDB ( ) ; $_db -> query ( $_sql ) ; $_affected_rows = $_db -> affected_rows ; DB:: unDB ( $_result = null , $_db ) ; return $_affected_rows ; }
1 2 3 4 5 6 7 8 //增删改模型 protected function aud ( $_sql ) { $_db = DB:: getDB ( ) ; $_db -> query ( $_sql ) ; $_affected_rows = $_db -> affected_rows ; DB:: unDB ( $_result = null , $_db ) ; return $_affected_rows ; }
PHP 1 2 3 4 5 6 7 8 //增删改模型 protected function aud ( $_sql ) { $_db = DB:: getDB ( ) ; $_db -> query ( $_sql ) ; $_affected_rows = $_db -> affected_rows ; DB:: unDB ( $_result = null , $_db ) ; return $_affected_rows ; }

这是我之前写的,第六行报错Strict Standards: Only variables should be passed by reference in,现在只要把$result拿出来单独赋值后再放在方法参数里就可以了。

PHPPHP
PHP
1 2 3 4 5 6 7 8 9 //增删改模型 protected function aud ( $_sql ) { $_db = DB:: getDB ( ) ; $_db -> query ( $_sql ) ; $_affected_rows = $_db -> affected_rows ; $_result = null ; DB:: unDB ( $_result , $_db ) ; return $_affected_rows ; }
1 2 3 4 5 6 7 8 9 //增删改模型 protected function aud ( $_sql ) { $_db = DB:: getDB ( ) ; $_db -> query ( $_sql ) ; $_affected_rows = $_db -> affected_rows ; $_result = null ; DB:: unDB ( $_result , $_db ) ; return $_affected_rows ; }
PHP 1 2 3 4 5 6 7 8 9 //增删改模型 protected function aud ( $_sql ) { $_db = DB:: getDB ( ) ; $_db -> query ( $_sql ) ; $_affected_rows = $_db -> affected_rows ; $_result = null ; DB:: unDB ( $_result , $_db ) ; return $_affected_rows ; }

4.安装完wampserver最好配置一下环境变量。右击我的电脑->属性->高级系统设置->环境变量,找到PATH,点编辑,然后复制wampserver目录下的binmysqlmysql5.7.14in,添加到PATH里面。

5.安装完wampserver需要手动修改mysql的密码,修改方法见。

6.我还遇到一个不知道由什么原因导致的错误,

PHPPHP
PHP
1 2 3 4 5 6 7 8 9 10 //show private function show ( ) { parent :: page ( $this -> _model -> getAllContentTotal ( ) ) ; $_object = $this -> _model -> getListContent ( ) ; $_limitobj = $this -> _model -> getListLimitContent ( ) ; $_floor = $this -> _model -> getListContentTotal ( ) ; $_total = $this -> _model -> getAllContentTotal ( ) ; . . . . . . }
1 2 3 4 5 6 7 8 9 10 //show private function show ( ) { parent :: page ( $this -> _model -> getAllContentTotal ( ) ) ; $_object = $this -> _model -> getListContent ( ) ; $_limitobj = $this -> _model -> getListLimitContent ( ) ; $_floor = $this -> _model -> getListContentTotal ( ) ; $_total = $this -> _model -> getAllContentTotal ( ) ; . . . . . . }
PHP 1 2 3 4 5 6 7 8 9 10 //show private function show ( ) { parent :: page ( $this -> _model -> getAllContentTotal ( ) ) ; $_object = $this -> _model -> getListContent ( ) ; $_limitobj = $this -> _model -> getListLimitContent ( ) ; $_floor = $this -> _model -> getListContentTotal ( ) ; $_total = $this -> _model -> getAllContentTotal ( ) ; . . . . . . }

这是修改后的,如果把$_limitobj = $this->_model->getListLimitContent();放到这个方法的第一行执行,就会导致页面加载不出来,报http error 500,只要把上面那行代码不放到第一行执行就可以了,奇怪的是在本地测试一点问题没有。

7.还有一个是最近安装wampserver遇到的问题,刚安装完后访问出现You dont have permission to access / on this server,但在服务器本地访问却没问题,就考虑到可能是Apache的访问规则没配置好,因为开了虚拟主机,所以要配置httpd-vhosts.conf文件。下面是没做更改前的配置,

DefaultDefault
Default
1 2 3 4 5 6 7 8 9 10 11 12 13 14 # Virtual Hosts # < VirtualHost * : 2020 > ServerName localhost ServerAlias localhost DocumentRoot G : / php / wamp / www < Directory "G:/php/wamp/www/" > Options + Indexes + Includes + FollowSymLinks + MultiViews AllowOverride All Require local < / Directory > < / VirtualHost > #
1 2 3 4 5 6 7 8 9 10 11 12 13 14 # Virtual Hosts # < VirtualHost * : 2020 > ServerName localhost ServerAlias localhost DocumentRoot G : / php / wamp / www < Directory "G:/php/wamp/www/" > Options + Indexes + Includes + FollowSymLinks + MultiViews AllowOverride All Require local < / Directory > < / VirtualHost > #
Default 1 2 3 4 5 6 7 8 9 10 11 12 13 14 # Virtual Hosts # < VirtualHost * : 2020 > ServerName localhost ServerAlias localhost DocumentRoot G : / php / wamp / www < Directory "G:/php/wamp/www/" > Options + Indexes + Includes + FollowSymLinks + MultiViews AllowOverride All Require local < / Directory > < / VirtualHost > #

注意到Require local这一行,只允许本地访问,需要把这行改成Require all granted,就可以了。

标签:icode9,语言, c++,编写,函数,高级功能,编译器,错误代码
来源:

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有