Install the MRC PHP Extension » History » Version 50
Amber Herold, 05/19/2010 12:24 PM
1 | 21 | Amber Herold | h1. Install the MRC PHP Extension |
---|---|---|---|
2 | 1 | Amber Herold | |
3 | 9 | Amber Herold | MRC Tools is installed as a php extension and is required for displaying mrc files live on the web browser. |
4 | 1 | Amber Herold | |
5 | 6 | Amber Herold | h2. Make sure you have installed the prerequisite packages |
6 | 1 | Amber Herold | |
7 | 24 | Amber Herold | You may find installation information for the following packages under [[Install Web Server Prerequisites]]. |
8 | 6 | Amber Herold | |
9 | h3. php-devel |
||
10 | |||
11 | 27 | Neil Voss | You can check whether php-devel is installed by typing: |
12 | <pre>phpize</pre> |
||
13 | 46 | Amber Herold | Do not worry about any error message as long as the command is found. |
14 | |||
15 | 4 | Amber Herold | |
16 | 6 | Amber Herold | h3. php-GD/FFTW3-devel |
17 | 4 | Amber Herold | |
18 | 6 | Amber Herold | Make sure that php-GD and FFTW 3 devel libraries are installed. |
19 | 4 | Amber Herold | |
20 | 8 | Amber Herold | *TODO:* provide a screenshot of info.php when correctly installed. |
21 | 4 | Amber Herold | |
22 | 11 | Amber Herold | *Note:* |
23 | 10 | Amber Herold | MRCtools are compiled and added to php extension with php-devel package. MRCtools use GD and FFTW3 that need to be compiled from their development libraries while the extension is compiled. If GD and FFTW3 sources were downloaded and compiled directly on your computer, these development files are included. If (as in most cases) GD and FFTW3 are installed from rpm, they are not included. An error message will appear when you attempt to compile mrctools. In this case, you will need separate download and installation of GD-devel and FFTW3-devel. Search http://rpmfind.net/linux/rpm2html/ for GD-devel and FFTW3-devel for the rpm distribution needed for your system. More information on the gd library can be found "here":http://www.php.net/manual/en/image.requirements.php. If you find that you can only view images as png instead of jpg, it may be that you do not have gd _jpeg_ support installed. |
24 | 1 | Amber Herold | |
25 | 10 | Amber Herold | h2. MRC Tools Installation |
26 | 4 | Amber Herold | |
27 | 27 | Neil Voss | h3. Go to myami/php_mrc directory |
28 | 5 | Amber Herold | |
29 | 28 | Neil Voss | h3. Compile and install the MRC module |
30 | |||
31 | 1 | Amber Herold | <pre> |
32 | 27 | Neil Voss | phpize |
33 | ./configure |
||
34 | make |
||
35 | sudo make install |
||
36 | 4 | Amber Herold | </pre> |
37 | 17 | Amber Herold | |
38 | 48 | Amber Herold | h3. Check that the mrc.so module exists in your php module directory |
39 | |||
40 | (e.g., @/usr/lib64/php/modules@ on 64bit CentOS/RHEL/Fedora). If you are unsure where the php module directory is, use http://localhost/info.php to find it under *extension_dir*. |
||
41 | 29 | Neil Voss | |
42 | 1 | Amber Herold | <pre> |
43 | 30 | Neil Voss | ls /usr/lib64/php/modules |
44 | 27 | Neil Voss | mrc.so |
45 | 1 | Amber Herold | </pre> |
46 | |||
47 | |||
48 | 4 | Amber Herold | |
49 | 31 | Neil Voss | h3. Edit your php configuration file, @php.ini@. |
50 | 1 | Amber Herold | |
51 | 49 | Amber Herold | If your linux distro does not have a /etc/php.d/ or /etc/php.d/conf.d/ directory where other .ini files reside, you may need to follow the alternate instructions below titled: _Alternative approach if mrc module does not show up in info.php output_. |
52 | 1 | Amber Herold | |
53 | 32 | Neil Voss | * Confirm the location of "additional .ini files parsed" from the info.php web page (/etc/php.d in this example) |
54 | 31 | Neil Voss | and create a file called "mrc.ini" in this directory. |
55 | 12 | Amber Herold | <pre> |
56 | 31 | Neil Voss | cd /etc/php.d |
57 | sudo touch /etc/php.d/mrc.ini |
||
58 | 33 | Neil Voss | sudo chmod 666 mrc.ini |
59 | 34 | Neil Voss | echo "; Enable mrc extension module" > mrc.ini |
60 | 1 | Amber Herold | echo "extension=mrc.so" >> mrc.ini |
61 | 33 | Neil Voss | sudo chmod 444 mrc.ini |
62 | cat mrc.ini |
||
63 | 19 | Amber Herold | </pre> |
64 | 4 | Amber Herold | |
65 | 31 | Neil Voss | *OR* |
66 | |||
67 | 32 | Neil Voss | * Add the "mrc.so" extension to the end of the *extension section* |
68 | <pre> |
||
69 | extension=mrc.so |
||
70 | </pre> |
||
71 | 4 | Amber Herold | |
72 | 36 | Neil Voss | h3. Restart your webserver |
73 | 1 | Amber Herold | |
74 | 50 | Amber Herold | Example commands: |
75 | 1 | Amber Herold | <pre> |
76 | 50 | Amber Herold | #SuSe |
77 | /etc/init.d/apache2 restart |
||
78 | |||
79 | #CentOS |
||
80 | sudo /sbin/service httpd restart |
||
81 | 4 | Amber Herold | </pre> |
82 | |||
83 | 36 | Neil Voss | h3. Verify the mrc tools installation |
84 | 4 | Amber Herold | |
85 | h4. Check php information |
||
86 | |||
87 | Visit or refresh http://yourhost/info.php which you created earlier. It should have a section looking like this (The version should correspond to what you've just installed): |
||
88 | |||
89 | !http://emg.nysbc.org/software/leginon/images/images/phpmrc.png! |
||
90 | |||
91 | If mrc is not listed, the extension did not get added in the right order. |
||
92 | |||
93 | h4. Alternative approach if mrc module does not show up in info.php output |
||
94 | |||
95 | 1. find in the info.php web page the location of "additional .ini files parsed" in the first table (such as /etc/php.d/conf.d/*). |
||
96 | |||
97 | 2. Go to the directory and make a copy of any ini file to use as a template for mrc.ini |
||
98 | 1 | Amber Herold | |
99 | 4 | Amber Herold | <pre> |
100 | >cd [additional_ini_directory] |
||
101 | 1 | Amber Herold | >cp gd.ini mrc.ini |
102 | </pre> |
||
103 | 4 | Amber Herold | |
104 | 1 | Amber Herold | 3. Edit mrc.ini to the following |
105 | |||
106 | 4 | Amber Herold | <pre> |
107 | ; comment out next line to disable mrc extension in php |
||
108 | 1 | Amber Herold | extension=mrc.so |
109 | </pre> |
||
110 | 4 | Amber Herold | |
111 | 1 | Amber Herold | 4. Comment out mrc extension from php.ini (found in /etc/php.ini/ on a typical PHP installation) |
112 | |||
113 | 4 | Amber Herold | <pre> |
114 | 1 | Amber Herold | ;extension=mrc.so |
115 | </pre> |
||
116 | 4 | Amber Herold | |
117 | 16 | Amber Herold | 5. Restart your webserver |
118 | 1 | Amber Herold | |
119 | 4 | Amber Herold | <pre> |
120 | 1 | Amber Herold | > /etc/init.d/httpd restart |
121 | </pre> |
||
122 | 4 | Amber Herold | |
123 | 1 | Amber Herold | h4. Test the MRC module installation |
124 | |||
125 | 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. |
||
126 | * gd module testing script "ex1.php":http://emg.nysbc.org/attachments/53/ex1.php |
||
127 | * fftw module testing script "ex2.php":http://emg.nysbc.org/attachments/54/ex2.php |
||
128 | |||
129 | 37 | Neil Voss | <pre> |
130 | 43 | Neil Voss | cd /var/www/html/ #CentOS |
131 | sudo wget http://emg.nysbc.org/attachments/download/55/mymrc.mrc |
||
132 | sudo wget http://emg.nysbc.org/attachments/download/53/ex1.php |
||
133 | sudo wget http://emg.nysbc.org/attachments/download/54/ex2.php |
||
134 | 39 | Neil Voss | </pre> |
135 | 37 | Neil Voss | |
136 | 44 | Neil Voss | Run the scripts with the following commands and visit the corresponding pages from the web server: |
137 | The expected results are shown below. If you get the same images, you've installed the extension properly. |
||
138 | 1 | Amber Herold | |
139 | 44 | Neil Voss | web server: http://localhost/ex1.php |
140 | |||
141 | 1 | Amber Herold | <pre> |
142 | 41 | Neil Voss | php -q ex1.php | display |
143 | 1 | Amber Herold | </pre> |
144 | |||
145 | * gd module test result: |
||
146 | !http://emg.nysbc.org/attachments/57/ex1.php.png! |
||
147 | 44 | Neil Voss | |
148 | web server: http://localhost/ex2.php |
||
149 | 1 | Amber Herold | |
150 | <pre> |
||
151 | 41 | Neil Voss | php -q ex2.php | display |
152 | 1 | Amber Herold | </pre> |
153 | 3 | Amber Herold | |
154 | * fftw module test result: |
||
155 | !http://emg.nysbc.org/attachments/58/ex2.php.png! |
||
156 | 1 | Amber Herold | |
157 | Test files work but images not showing up in the ImageViewers? |
||
158 | [[Troubleshooting Notes|Here's one way this was fixed.]] |
||
159 | 22 | Amber Herold | |
160 | ______ |
||
161 | |||
162 | 47 | Amber Herold | [[Download Appion and Leginon Files|< Download Appion and Leginon Files]] | [[Install the Web Interface|Install the Web Interface >>]] |
163 | 25 | Amber Herold | |
164 | |||
165 | ______ |