Project

General

Profile

Install the MRC PHP Extension » History » Version 2

Amber Herold, 03/17/2010 02:29 PM

1 1 Amber Herold
h1. MRC PHP Extension Installation and Testing
2
3
h3. 4.1 Build the MRC module
4
5
Download "php_mrc_src_1_5_1.tgz":http://emg.nysbc.org/software/dwd.php?id=N1HDb4ac22efb5b38b05fd3575d42d3e4adc2
6
7
h4. cd to your php devel directory
8
9
<pre>
10
> cd /usr/include/php/ext/
11
> mv [downloads]/php_mrc_src_1_5_1.tgz .
12
</pre>
13
14
h4. Untar the archive
15
16
<pre>
17
> tar zxvf php_mrc_src_1_5_1.tgz
18
> cd mrc/
19
</pre>
20
21
h4. Make sure that GD and FFTW 3 devel libraries are installed
22
23
<pre>
24
> phpize
25
> ./configure 
26
> make
27
> make install
28
</pre>
29
30
h3. 4.2 Install MRC module
31
32
h4.  Check that mrc.so is in your php extension directory
33
34
<pre>
35
> ls /usr/lib/php/extensions
36
</pre>
37
38
You should see mrc.so listed.
39
40
h4. Make sure that GD and FFTW 3 libraries are installed
41
42
* edit your  php configuration file php.ini to add "mrc.so" extension.
43
* You might also increase the memory_limit field. It is set to 8M by default. The more the merrier!
44
* 4kx4k float MRC image is about 64MB
45
<pre>
46
> vi /etc/php.ini
47
</pre>
48
49
* increase memory
50
<pre>
51
> memory_limit = 256M; Maximum amount of memory
52
</pre>
53
54
* Create the mrc.ini file
55
56
<pre>
57
> cd /etc/php.d
58
vi mrc.ini
59
</pre>
60
61
* add the following lines
62
63
<pre>
64
 ; Enable mrc extension module
65
 extension=mrc.so
66
</pre>
67
68
*NOTE:* If PHP modules are already listed in PHP.ini do the following:
69
70
* check extension_dir value
71
<pre>
72
 extension_dir = /usr/lib64/php/extensions
73
</pre>
74
75
* add the following at the end of the [extension section]
76
77
<pre>
78
 extension=mrc.so
79
</pre>
80
81
h4. Restart your webserver
82
83
<pre>
84
/etc/init.d/apache2 restart
85
</pre>
86
87
OR
88
89
<pre>
90
/etc/init.d/httpd restart
91
</pre>
92
93
h3. 4.3 Test the MRC module installation
94
95
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. 
96
* gd module testing script "ex1.php":http://emg.nysbc.org/attachments/53/ex1.php
97
* fftw module testing script "ex2.php":http://emg.nysbc.org/attachments/54/ex2.php
98
99
Run the scripts with the following commands:
100
The expected results are shown below. If you get the same images, you've installed the extension properly.
101
102
<pre>
103
> php -q ex1.php | display
104
</pre>
105
106
* gd module test result:
107
!http://emg.nysbc.org/attachments/57/ex1.php.png!
108
109
<pre>
110
> php -q ex2.php | display
111
</pre>
112
113
* fftw module test result:
114
!http://emg.nysbc.org/attachments/58/ex2.php.png!