본문 바로가기
Development/PHP

PHP Closure 에서 $this 호출 에러

by Dev. Jkun 2014. 2. 16.
반응형

에러 메세지는 using $this when not in object context in ... 등등 하고 나온다. 

신기하게도 회사에서의 우분투환경에서는 에러가 발생하지 않는데 집에서 새로 구성한 우분투에서는 위하고 똑같은 에러가

발생한다. 코드는 단 한줄도 한자도 수정하지 않았는데.

해서 구글링을.. 오랜 시간 하다보니... 버젼 문제였다.


PHP 5.4.10 is not available in the Ubuntu repositories for 12.04.

You have two options:

(1) try and find a PPA with a backported version of PHP 5.4.10 (such as ondrej's oldstable PPA)

a) Run this command: sudo apt-get install python-software-properties
b) Run this command: sudo add-apt-repository ppa:ondrej/php5-oldstable
c) Run sudo apt-get update; sudo apt-get install php5
d) This should allow you to use PHP 5.4.10 (or whatever the most recent "Old Stable PHP" is).

(2) download PHP from source, and compile it.

Otherwise, you'll have to wait for Saucy to be released, so that you can get PHP 5.5.3. 5.4.10 does not exist in the repositories for any version of Ubuntu, apparently.

(I can try and backport 5.4.10 from Debian if you would like, but it would be in a PPA, so you'd have to trust that I'm not giving you malware, although I wouldn't do that ever.)


등등이라고 스택오버플로우에서 나옴.

그러고 보니 집에서 구성해놓은 우분투에는 PHP 5.3 인데 회사에서는 5.4 였다. 


위처럼 해서 터미널에서 실행하니 잘 됨. ㅠㅠ;; 이런 삽질 싫다..ㅡㅡ;

반응형

댓글