Minimizing harm on upgrading extensions on busy server.
I upgraded (phpize,make... way) APC-extension on quite busy server and found out that Apache segfaults if i just restart it gracefully with the new extension in place. I found a way around this, so that the users of the server only see small slow down of the services.
1. Comment out extension loading (old extension) in php.ini (or separate .ini-file).
2. Restart Apache gracefully (now system runs without extension).
3. Replace old extension with new version (can be done already before first restart) and edit .ini again to include extension.
4. Restart Apache gracefully again (new extension loads).
Of course this only works for extensions which your php-application can live without for a short period of time. ;-)
phpize로 공유 PECL 확장모듈 컴파일하기
가끔은, pecl 인스톨러를 사용하는것이 선택사항이 아닐수 있습니다. 방화벽뒤에 있거나, CVS의 릴리즈되지 않은 확장 모듈처럼 설치할 PECL 호환패키지가 없는것이 이유가 될 것입니다. 이런 확장모듈을 빌드할 필요가 있을 경우, 좀더 하위 레벨의 빌드툴을 사용하여 직접 빌드할수가 있습니다.
phpize 명령은 PHP 확장모듈을 위한 빌드환경을 만들기 위해 사용합니다. 아래의 샘플코드에는 확장모듈의 소스가 extname 이름의 디렉터리 안에 있습니다.:
$ cd extname $ phpize $ ./configure $ make # make install
성공적으로 인스톨되었다면 extname.so 이 생성될것이고, 그것을 PHP의 확장모듈 디렉터리 안에 위치시킬 것입니다. 확장 모듈을 사용하기전에 php.ini 에 extension=extname.so 라인의 추가가 필요할 것입니다.
만약에 시스템이 phpize 명령을 찾지 못하고, 미리컴파일된 패키지(RPM 같은)를 사용하고 있다면, 적절한 버전의 PHP devel 패키지를 설치하도록 합니다. 그것들은 대체로 phpize 명령 이외에 PHP와 확장모듈을 빌드할 적절한 헤더파일을 포함합니다.
phpize --help 를 실행하면 추가적인 사용법 정보를 볼수가 있습니다.
jplahti
29-Aug-2008 01:48
Brian
01-May-2008 01:39
If you have multiple PHP versions installed, you may be able to specify for which installation you'd like to build by using the --with-php-config option during configuration.
--with-php-config=[Insert path to proper php-config here]
For example (my case):
./configure --with-php-config=/usr/local/php5/bin/php-config5
Glen
17-May-2007 06:07
When you have multiple installations of PHP, running phpize from a specific installation will not force the module to be compiled with that installation's include files.
In my case, I had a standard PHP distribution installed, and am evaluating Zend Core / Zend Platform, which installed it's own Apache & PHP in a /usr/local/Zend/.. install path. It was missing the json.so module, so I had to compile my own.
Running Zend Core's phpize, the output indicates that configuration for that module will occur. But when running ./configure, the standard installation's include files are used. The result json.so being compiled against the wrong PHP would not load when Zend Core's php initializes.
The only way I could see to correct the situation was to temporarily change the standard PHP include path to point to the Zend Core's include files. In my case, I made a backup copy of /usr/include/php5 and did a "ln -s /usr/local/Zend/Core/include/php/ /usr/include/php5".
dmytton at php dot net
03-Dec-2005 12:45
In some situations (e.g. on a cPanel server), the built extension will not be placed into the correct extensions directory by the make install process. Use your phpinfo() output to determine what the correct extension_dir path is and move the generated .so file into that directory. The extension=extname.so line in php.ini will then find the extension file correctly.
