Project

General

Profile

Install the MRC PHP Extension » History » Revision 4

Revision 3 (Amber Herold, 03/26/2010 03:00 PM) → Revision 4/80 (Amber Herold, 04/06/2010 11:11 AM)

h1. MRC PHP Extension Installation and Testing 

 mrctools is installed as a php extension and is required for displaying mrc files live on h3. 4.1 Build the web browser. MRC module 

 h2. Install php-devel packages on the web server if missing: 

 You can check whether php-devel is installed by typing 

 <pre> 
  >phpize 
 </pre> 

 Follow the instructions for your specific Linux distribution. 
 For example, SUSE users can use YaST or zypper to install them. 

 h2. php-GD/FFTW3-devel 

 Follow instructions from the download site. These may be included already. If not, the mrctools installation will fail. 
 *TODO:* add link to prereqs 

 h2. mrctools Installation 

 mrctools is installed from the php devel directory. This is usually located in /usr/include/php/ext where you will find other php extension source such as gd. After the installation, mrc.so should be placed in php's extension directory. The location of the extension directory can be found by looking for "extension_dir" in http://your_host/info.php. 

 h3. 1 Download "php_mrc_src_1_5_1.tgz":http://emg.nysbc.org/attachments/107/php_mrc_src_1_5_1.tgz. "php_mrc_src_1_5_1.tgz":http://emg.nysbc.org/software/dwd.php?id=N1HDb4ac22efb5b38b05fd3575d42d3e4adc2 

 h3. 2 h4. cd to your php devel directory 

 <pre> 
 > cd /usr/include/php/ext/ 
 > mv [downloads]/php_mrc_src_[x].tgz [downloads]/php_mrc_src_1_5_1.tgz . 
 </pre> 

 h3. 3 untar h4. Untar the archive 

 <pre> 
 > tar zxvf php_mrc_src_[x].tgz php_mrc_src_1_5_1.tgz 
 > cd mrc/ 
 </pre> 

 h3. 4 h4. Make sure that php-GD GD and FFTW 3 devel libraries are installed 

 *TODO:* Combine this section with the others dealing with this and provide a screenshot of info.php when correctly installed. 

 <pre> 
 > phpize 
 > ./configure  
 > make 
 > make install 
 </pre> 

 More information on the gd library can be found "here":http://www.php.net/manual/en/image.requirements.php. 
 If you find h3. 4.2 Install MRC module 

 h4.    Check that you can only view images as png instead of jpg, it may be that you do not have gd jpeg support installed. 


 h3. 5 mrc.so should be is in your php extension directory 

 <pre> 
 > ls /usr/lib/php/extensions 
 </pre> 

 You should see mrc.so 
 </pre> 



 h3. 6 Edit listed. 

 h4. Make sure that GD and FFTW 3 libraries are installed 

 * edit your    php configuration file. 

 <pre> file php.ini to add "mrc.so" extension. 
 > vi /etc/php.ini 
 </pre> 

 * Increase memory 

 You should 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> 

 * Check extension_dir value 
 <pre> 
 extension_dir = /usr/lib/php/extensions 
 </pre> 



 * Add Create the "mrc.so" extension to the end of the *extension section* 

  <pre> 
  extension=mrc.so 
  </pre> 
 *Note:* If you do not see a number of extensions already activated in this section, you should probably follow the alternative path below to enable the extension in a separate mrc.ini file 

 *OR* 

  * if your linux distro has a /etc/php.d/ or /etc/php.d/conf.d/ directory where other .ini files reside, create and edit mrc.ini: 
  <pre> 
  
 > cd /etc/php.d 
  > 
 vi mrc.ini 
  
 </pre> 
 
  

 * add the following lines 
  

 <pre> 
  ; Enable mrc extension module 
  extension=mrc.so 
  </pre> 

 h3. 7 restart your webserver 

 <pre> 
 > /etc/init.d/apache2 restart 
 </pre> 
 
 *OR* 

 <pre> 
 > /etc/init.d/httpd restart 
 </pre> 


 h3. 8 Verify the mrc tools installation 

 h4. Check php information 

 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): 

 !http://emg.nysbc.org/software/leginon/images/images/phpmrc.png! 

 *NOTE:* If mrc is not listed, the extension did not get added PHP modules are already listed in PHP.ini do the right order. following: 

 h4. Alternative approach if mrc module does not show up in info.php output 

 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/*). 

 2. Go to the directory and make a copy of any ini file to use as a template for mrc.ini 

 * check extension_dir value 
 <pre> 
       >cd [additional_ini_directory] 
       >cp gd.ini mrc.ini 
  extension_dir = /usr/lib64/php/extensions 
 </pre> 

 3. Edit mrc.ini to * add the following at the end of the [extension section] 

 <pre> 
       ; comment out next line to disable mrc extension in php 
       
  extension=mrc.so 
 </pre> 

 4. Comment out mrc extension from php.ini (found in /etc/php.ini/ on a typical PHP installation) h4. Restart your webserver 

 <pre> 
       ;extension=mrc.so 
 /etc/init.d/apache2 restart 
 </pre> 

 5. restart your webserver OR 

 <pre> 
       > 
 /etc/init.d/httpd restart 
 </pre> 

 h4. 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.]]