Install the MRC PHP Extension » History » Revision 3
Revision 2 (Amber Herold, 03/17/2010 02:29 PM) → Revision 3/80 (Amber Herold, 03/26/2010 03:00 PM)
h1. MRC PHP Extension Installation and Testing
h3. 4.1 Build the MRC module
Download "php_mrc_src_1_5_1.tgz":http://emg.nysbc.org/software/dwd.php?id=N1HDb4ac22efb5b38b05fd3575d42d3e4adc2
h4. cd to your php devel directory
<pre>
> cd /usr/include/php/ext/
> mv [downloads]/php_mrc_src_1_5_1.tgz .
</pre>
h4. Untar the archive
<pre>
> tar zxvf php_mrc_src_1_5_1.tgz
> cd mrc/
</pre>
h4. Make sure that GD and FFTW 3 devel libraries are installed
<pre>
> phpize
> ./configure
> make
> make install
</pre>
h3. 4.2 Install MRC module
h4. Check that mrc.so is in your php extension directory
<pre>
> ls /usr/lib/php/extensions
</pre>
You should see mrc.so listed.
h4. Make sure that GD and FFTW 3 libraries are installed
* edit your php configuration file php.ini to add "mrc.so" extension.
* You might also increase the memory_limit field. It is set to 8M by default. The more the merrier!
* 4kx4k float MRC image is about 64MB
<pre>
> vi /etc/php.ini
</pre>
* increase memory
<pre>
> memory_limit = 256M; Maximum amount of memory
</pre>
* Create the mrc.ini file
<pre>
> cd /etc/php.d
vi mrc.ini
</pre>
* add the following lines
<pre>
; Enable mrc extension module
extension=mrc.so
</pre>
*NOTE:* If PHP modules are already listed in PHP.ini do the following:
* check extension_dir value
<pre>
extension_dir = /usr/lib64/php/extensions
</pre>
* add the following at the end of the [extension section]
<pre>
extension=mrc.so
</pre>
h4. Restart your webserver
<pre>
/etc/init.d/apache2 restart
</pre>
OR
<pre>
/etc/init.d/httpd restart
</pre>
h3. 4.3 Test the MRC module installation
Download this MRC file "mymrc.mrc":http://emg.nysbc.org/attachments/55/mymrc.mrc and the following 2 scripts into the same directory to test the PHP mrc extension.
* gd module testing script "ex1.php":http://emg.nysbc.org/attachments/53/ex1.php
* fftw module testing script "ex2.php":http://emg.nysbc.org/attachments/54/ex2.php
Run the scripts with the following commands:
The expected results are shown below. If you get the same images, you've installed the extension properly.
<pre>
> php -q ex1.php | display
</pre>
* gd module test result:
!http://emg.nysbc.org/attachments/57/ex1.php.png!
<pre>
> php -q ex2.php | display
</pre>
* fftw module test result:
!http://emg.nysbc.org/attachments/58/ex2.php.png!
Test files work but images not showing up in the ImageViewers?
[[Troubleshooting Notes|Here's one way this was fixed.]]