Development/PHP
Cannot re-assign auto-global variable _GET 에러
곽진돔
2023. 1. 17. 10:41
Cannot re-assign auto-global variable _GET
PHP 버전업에 따른 문제로, 5.3까지는 사용 가능하며 5.4부터 발생하는 에러이다.
php.ini에서 rester_globals 를 On 으로 하면 변수가 get, post, session 변수인지 체크하지 않아도 되는데, 5.4부터 register_globals가 없어졌다고 한다.
파라미터이름을 $_GET 대신 다른걸로 변경하다가, 변경된 사항이 많아서 그냥 다운그레이드 하기로 결정했다(..)
[변수] => ['변수'], 정규 표현식 등등.. 기존 라이브러리 함수도 그렇고 변환해야될게 너무 많아서 다운 그레이드하고, 버전업은 다른 서버에서 테스트하려고 한다.
php 5.3 설치
wget https://www.php.net/distributions/php-5.3.27.tar.gz
압축해제
tar xvfpz php-5.3.27.tar.gz
경로 이동
cd php-5.3.27
./configure
./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-curl --disable-debug --enable-safe-mode --enable-sockets --enable-sysvsem=yes --enable-sysvshm=yes --enable-ftp --enable-magic-quotes --with-ttf --enable-gd-native-ttf --enable-inline-optimization --enable-bcmath --with-zlib --with-gd --with-gettext --with-jpeg-dir=/usr --with-png-dir=/usr/lib --with-freetype-dir=/usr --with-libxml-dir=/usr --enable-exif --enable-sigchild --enable-mbstring --with-openssl
make && make install