Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
vms:webdev:phpfarm [2014/11/03 13:27]
admin [Configuration files]
vms:webdev:phpfarm [2016/11/29 17:48] (current)
admin [Create PHP Execution (wrapper) Scripts]
Line 36: Line 36:
  
 ==== Configuration files ==== ==== Configuration files ====
-<color darkslateblue>​**Please note that those files location slightly differs from the original (cweiske) ​version**</color>. Here they reside in **/​opt/​phpfarm/​custom/​options.sh** and **/​opt/​phpfarm/custom/php.ini** while in the original, they resided in **/​opt/​phpfarm/​src/custom-options.sh** and **/opt/phpfarm/​src/​custom-php.ini**, also the /opt/​phpfarm/​custom directory **is not present after standard git cloning** ​(as of release dd4a369), so you'll need to create this directory by yourself, we'll also move the default custom ​options ​file to this location:+As described in the README.rst file:\\ 
 +Default configuration options are in src/​options.sh. You may create ​version-specific custom option  
 +<code> 
 +src/​custom/​options.sh 
 +src/custom/options-<​major>​.sh 
 +src/custom/options-<​major>​.<​minor>​.sh 
 +src/custom/options-<​major>​.<​minor>​.<​patch>​.sh 
 +src/custom/options-<​major>​.<​minor>​.<​patch>​-<​flags>​.sh 
 +</code> 
 + 
 +Where: 
 + 
 +<​major> ​is the version'​s major number ​(eg. "​5"​ for PHP 5.3.1).\\ 
 +<​minor>​ is the version's minor number (eg. "​3"​ for PHP 5.3.1).\\ 
 +<​patch>​ is the version's patch number (eg. "​1"​ for PHP 5.3.1).\\ 
 +<​flag>​ matches ​the specific compilation/​installation flags (if any) for that PHP version. 
 + 
 +See Special flags in version strings for information on supported flags. The flags should appear in the exact same order as listed in that chapter for this to work. 
 + 
 +The shell script needs to define a variable named $configoptions with all ./​configure ​options. Do not try to change prefix and exec-prefix.
  
 <​code>​ <​code>​
 > sudo mkdir /​opt/​phpfarm/​custom > sudo mkdir /​opt/​phpfarm/​custom
-> sudo mv /​opt/​phpfarm/​src/​default-custom-php.ini /​opt/​phpfarm/​custom/​+> sudo cp /​opt/​phpfarm/​src/​default-custom-php.ini /​opt/​phpfarm/​custom/​
 </​code>​ </​code>​
  
 The global compile options for the PHP versions you'll install can be set in:\\ The global compile options for the PHP versions you'll install can be set in:\\
 <color darkslateblue>​**/​opt/​phpfarm/​custom/​options.sh**</​color>​ <color darkslateblue>​**/​opt/​phpfarm/​custom/​options.sh**</​color>​
 +
 +See below for a sample content of such file, it should obviously be adapted to your specific php compile options requierments.
  
 It is also possible to create per-version custom options file by specifying the version number in the file name:\\ It is also possible to create per-version custom options file by specifying the version number in the file name:\\
Line 104: Line 125:
 <​code>​ <​code>​
 date.timezone=Europe/​Brussels date.timezone=Europe/​Brussels
 +extension_dir="​$ext_dir"​
 include_path="​.:/​opt/​phpfarm/​inst/​php-$version/​pear/​php/"​ include_path="​.:/​opt/​phpfarm/​inst/​php-$version/​pear/​php/"​
 </​code>​ </​code>​
Line 177: Line 199:
  
 <WRAP center round info 90%> <WRAP center round info 90%>
-It is important to note that for suEXEC to allow execution of a cgi (wrapper)script,​ the containing directory, as well as the executable files, must all have the same owner as the one executing the suEXEC call (see SuexecUserGroup in the Apche's virtual host's config file).\\+It is important to note that for suEXEC to allow execution of a cgi (wrapper)script,​ the containing directory, as well as the executable files, must all have the same owner as the one executing the suEXEC call (see SuexecUserGroup in the Apache's virtual host's config file).\\
 Also, this directory, as well as the executable files it contains, cannot be writable by anyone but their owner.\\ Also, this directory, as well as the executable files it contains, cannot be writable by anyone but their owner.\\
 Please pay attention to this, as it might result in apache throwing internal error 500 when trying to run a wrongly owned script. ​ Please pay attention to this, as it might result in apache throwing internal error 500 when trying to run a wrongly owned script. ​
Line 197: Line 219:
 $ ls -la /​home/<​username>/​Documents/​webdev/​www $ ls -la /​home/<​username>/​Documents/​webdev/​www
 total 28 total 28
-drwxr-xr-x 2 thibaut thibaut ​4096 May  4 07:36 . +drwxr-xr-x 2 user group 4096 May  4 07:36 . 
-drwxr-xr-x 4 thibaut thibaut ​4096 May  4 07:25 .. +drwxr-xr-x 4 user group 4096 May  4 07:25 .. 
--rw-r--r-- 1 thibaut thibaut ​ 210 May  4 07:29 php-cgi-5.2.17 +-rw-r--r-- 1 user group  210 May  4 07:29 php-cgi-5.2.17 
--rw-r--r-- 1 thibaut thibaut ​ 211 May  4 07:34 php-cgi-5.3.27 +-rw-r--r-- 1 user group  211 May  4 07:34 php-cgi-5.3.27 
--rw-r--r-- 1 thibaut thibaut ​ 211 May  4 07:35 php-cgi-5.4.27 +-rw-r--r-- 1 user group  211 May  4 07:35 php-cgi-5.4.27 
--rw-r--r-- 1 thibaut thibaut ​ 209 May  4 07:35 php-cgi-5.4.4 +-rw-r--r-- 1 user group  209 May  4 07:35 php-cgi-5.4.4 
--rw-r--r-- 1 thibaut thibaut ​ 211 May  4 07:36 php-cgi-5.5.11+-rw-r--r-- 1 user group  211 May  4 07:36 php-cgi-5.5.11
 </​code>​ </​code>​
  
Line 224: Line 246:
 ===== Define System Default PHP Version ===== ===== Define System Default PHP Version =====
 ----- -----
-Using PHPFarm doesn'​t define a "system wide" PHP executable. In some situations you'​ll ​xant to have one version of PHP as your system'​s default ​(for cron jobs for example).+Using PHPFarm doesn'​t define a "command line" PHP executable. In some situations you'​ll ​want to have one version of PHP as your system'​s default.
  
-Using the switch-phpfarm commandyou can define which version of PHP has to be used as the system default PHP executable:+To do thisfirst add inst/bin, inst/​current/​bin and inst/​current/​sbin ​to your $PATH in ~/.bashrc: 
 +<​code>​ 
 +> nano $HOME/​.bashrc
  
-<​code>​ +ADD THIS AT THE END: 
-> cd /​opt/​phpfarm/​inst/​bin +# phpfarm binaries 
-> ./switch-phpfarm ​5.4.4+PATH="​$PATH:​/​opt/​phpfarm/​inst/​bin:/opt/phpfarm/​inst/​current/​bin:/​opt/​phpfarm/​inst/​current/​sbin"​
 </​code>​ </​code>​
  
-<color coral>​**THIS NEEDS TO BE VERIFIED AS IT DOESN'​T SEEM TO WORK...**</​color>​ +You could logout and login to a new session to have this modification active, but if you do not want to restart your session ​for this, issue:
-++++ +
-A possible solution that still needs to be validated:​| +
-[[http://​stackoverflow.com/​questions/​23330670/​multiple-php-on-apache-centos]] +
- +
-add this to the bottom of .bashrc ​for root and non-root user. The .bashrc file can be found in the users root folder or cd ~/ then ls -all and you should see it.+
 <​code>​ <​code>​
-PATH="$PATH:/opt/​phpfarm/​inst/​bin:/​opt/​phpfarm/​inst/​current-bin"​+> source ​$HOME/.bashrc
 </​code>​ </​code>​
  
-also execute this in terminal after you have added it to the .bashrc files for root and non-root user+Using the switch-phpfarm command, ​you can check or define which version of PHP has to use as the system default PHP executable:
  
 +Without a version number it will show you the currently available PHP versions, a star will indicate the current default:
 <​code>​ <​code>​
-export PATH="​$PATH:/​opt/​phpfarm/​inst/​bin:/​opt/​phpfarm/​inst/​current-bin"+> switch-phpfarm 
 +  5.4.4 
 +* 5.4.6 
 + 
 +> switch-phpfarm ​5.4.4 
 +Setting active PHP version to 5.4.4 
 +PHP 5.4.4 (cli) (built: Nov  3 2014 13:33:16)  
 +Copyright (c) 1997-2012 The PHP Group 
 +Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
 </​code>​ </​code>​
  
-now exit the terminal and log back in. try this command+To make sure you now have the desired php version available from the command ​line: 
 +<​code>​ 
 +> php -v 
 +PHP 5.4.4 (cli) (built: Nov  3 2014 13:33:16)  
 +Copyright (c) 1997-2012 The PHP Group 
 +Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
  
-<code+which php 
-> switch-phpfarm ​5.5.11+/opt/phpfarm/​inst/​current/​bin/​php
 </​code>​ </​code>​
-++++ 
 ----- -----
 ===== Install Xdebug ===== ===== Install Xdebug =====
 ----- -----
 In a PHP development environment,​ have a debugger might come handy, follow [[vms:​webdev:​phpfarm:​xdebug|the instructions of this section]] to install XDebug on top of your chosen PHP version. In a PHP development environment,​ have a debugger might come handy, follow [[vms:​webdev:​phpfarm:​xdebug|the instructions of this section]] to install XDebug on top of your chosen PHP version.