Link to home
Create AccountLog in
Avatar of ITCity
ITCity

asked on

php load version on lighttpd

I have a freebsd server.  I have php loaded on the server I have 2 extensions versions loaded.  5.1.6 and the latest 5.3.8.  I am currently using 5.1.6.  How to I tell the server lighttpd to use the new version now 5.3.8 without deleting 5.1.6?

My pkg_info show the  following:

php5-5.3.8          PHP Scripting Language
php5-bz2-5.1.6      The bz2 shared extension for php
php5-bz2-5.3.8      The bz2 shared extension for php
php5-ctype-5.1.6    The ctype shared extension for php
php5-ctype-5.3.8    The ctype shared extension for php
php5-curl-5.1.6     The curl shared extension for php
php5-curl-5.3.8     The curl shared extension for php
php5-dom-5.1.6      The dom shared extension for php
php5-dom-5.3.8      The dom shared extension for php
php5-extensions-1.6 A "meta-port" to install PHP extensions
php5-filter-5.3.8   The filter shared extension for php
php5-ftp-5.1.6      The ftp shared extension for php
php5-ftp-5.3.8      The ftp shared extension for php
php5-gd-5.1.6       The gd shared extension for php
php5-hash-5.3.8     The hash shared extension for php
php5-iconv-5.1.6    The iconv shared extension for php
php5-iconv-5.3.8    The iconv shared extension for php
php5-json-5.3.8     The json shared extension for php
php5-mysql-5.1.6    The mysql shared extension for php
php5-mysql-5.3.8    The mysql shared extension for php
php5-openssl-5.1.6  The openssl shared extension for php
php5-openssl-5.3.8  The openssl shared extension for php
php5-pdo-5.3.8      The pdo shared extension for php
php5-phar-5.3.8     The phar shared extension for php
php5-posix-5.1.6    The posix shared extension for php
php5-posix-5.3.8    The posix shared extension for php
php5-session-5.1.6  The session shared extension for php
php5-session-5.3.8  The session shared extension for php
php5-simplexml-5.1.6 The simplexml shared extension for php
php5-simplexml-5.3.8 The simplexml shared extension for php
php5-soap-5.1.6     The soap shared extension for php
php5-soap-5.3.8     The soap shared extension for php
php5-sockets-5.1.6  The sockets shared extension for php
php5-sockets-5.3.8  The sockets shared extension for php
php5-sqlite-5.1.6   The sqlite shared extension for php
php5-tokenizer-5.1.6 The tokenizer shared extension for php
php5-tokenizer-5.3.8 The tokenizer shared extension for php
php5-xml-5.1.6      The xml shared extension for php
php5-xml-5.3.8      The xml shared extension for php
php5-xmlreader-5.1.6 The xmlreader shared extension for php
php5-xmlreader-5.3.8 The xmlreader shared extension for php
php5-xmlwriter-5.1.6 The xmlwriter shared extension for php
php5-xmlwriter-5.3.8 The xmlwriter shared extension for php
php5-zip-5.3.8      The zip shared extension for php
php5-zlib-5.1.6     The zlib shared extension for php
php5-zlib-5.3.8     The zlib shared extension for php
Avatar of xterm
xterm

You need to modify this section of lightpd.conf

fastcgi.server = ( ".php" => ((
                     "bin-path" => "/path/to/php-cgi",

Change it to the php-cgi executable that is in PHP 5.38.  

You can use "locate php-cgi" to find all of them first, and then do "php-cgi -v" to determine which version is the right one.
Avatar of ITCity

ASKER

This is what I have now.  How would it change?

fastcgi.server = (
".php" =>
   (( "socket" => "/tmp/php-fastcgi.socket",
      "bin-path" => "/usr/local/bin/php-cgi",
      "bin-environment" => (
        "PHP_FCGI_CHILDREN" => "4",
        "PHP_FCGI_MAX_REQUESTS" => "10000"
      ),
      "min-procs" => 1,
      "max-procs" => 20,
      "max-load-per-proc" => 4,
      "idle-timeout" => 30,
   )),

Avatar of ITCity

ASKER

When I do a phpinfo(), then I get a display that shows me using PHP Version 5.1.6.

I want my phpinfo() to show the new version.
"bin-path" => "/usr/local/bin/php-cgi",

This line needs to be:

"bin-path" => "/path/to/location/of/php-5.3.8/php-cgi",


You will need to find the php-cgi on your system that is version 5.3.8 and then put its location in that line, as I describe above.

Avatar of ITCity

ASKER

What is the command to locate that folder "php-5.3.8" ?  I dont have a folder for 5.3.  I did a ports install on this php version.

Also

The core of my php I believe is already 5.3 but the extentions show diffrently..

Thanks,

Please do the command "locate php-cgi".

It will likely give you several answers.. something like:

/usr/bin/php-cgi
/usr/local/bin/php-cgi
/some/other/php-cgi

You need to identify WHICH of these is the right one, because it sounds like you have version 5.3.8 and the old 5.1.6 one installed.  The way you do this is to run each of them until you find the one that tells you it is version 5.3.8.  That is the one you will put into the config file, and then you can restart lighttpd and it will load the new one.


xterm@dellxps:~$ /usr/bin/php-cgi -v
PHP 5.3.6-13ubuntu3.2 with Suhosin-Patch (cgi-fcgi) (built: Oct 13 2011 23:13:37)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

Open in new window

Avatar of ITCity

ASKER


Location of the PHP.
/usr/local/bin/php-cgi

This is what I get when I do the php-cgi -v


PHP Warning:  Module 'bz2' already loaded in Unknown on line 0
PHP Warning:  Module 'ctype' already loaded in Unknown on line 0
PHP Warning:  Module 'curl' already loaded in Unknown on line 0
PHP Warning:  Module 'dom' already loaded in Unknown on line 0
PHP Warning:  Module 'ftp' already loaded in Unknown on line 0
PHP Warning:  Module 'iconv' already loaded in Unknown on line 0
PHP Warning:  Module 'mysql' already loaded in Unknown on line 0
PHP Warning:  Module 'openssl' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'posix' already loaded in Unknown on line 0
PHP Warning:  Module 'session' already loaded in Unknown on line 0
PHP Warning:  Module 'SimpleXML' already loaded in Unknown on line 0
PHP Warning:  Module 'soap' already loaded in Unknown on line 0
PHP Warning:  Module 'sockets' already loaded in Unknown on line 0
PHP Warning:  Module 'tokenizer' already loaded in Unknown on line 0
PHP Warning:  Module 'xml' already loaded in Unknown on line 0
PHP Warning:  Module 'xmlreader' already loaded in Unknown on line 0
PHP Warning:  Module 'xmlwriter' already loaded in Unknown on line 0
PHP Warning:  Module 'zip' already loaded in Unknown on line 0
PHP Warning:  Module 'zlib' already loaded in Unknown on line 0
PHP Warning:  Module 'SQLite' already loaded in Unknown on line 0
PHP Deprecated:  Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
<br />
<b>Deprecated</b>:  Directive 'register_globals' is deprecated in PHP 5.3 and greater in <b>Unknown</b> on line <b>0</b><br />
PHP Deprecated:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
<br />
<b>Deprecated</b>:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in <b>Unknown</b> on line <b>0</b><br />
PHP 5.3.8 (cgi-fcgi) (built: Dec  8 2011 23:01:39)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
Okay, then you only have one, and it is the correct version.  All you need to do is restart lighttpd and it will load the new module.

After the restart, phpinfo() should show 5.3.8
Avatar of ITCity

ASKER

I have stopped and started lighttpd and still show the same version on the php info page.

Thanks,
Avatar of ITCity

ASKER

My php.conf shows this. located in /usr/local/etc
PHP_VER=5
PHP_VERSION=5.3.8
PHP_SAPI=cli cgi
PHP_EXT_INC=pcre spl
What command are you using to stop/start lighttpd?  Are you 100% sure that it wasn't still running?
Avatar of ITCity

ASKER

/usr/local/etc/rc.d/lighttpd stop


/usr/local/etc/rc.d/lighttpd start
Please attach your lighttpd.conf to this question so I can look at it?  Use the "File" link beneath the text entry box.
Avatar of ITCity

ASKER

here you go
lighttpd.txt
Is the file that you are running phpinfo() in named something.php or something.phtml?

Please run this command for me:
/usr/local/bin/php -v

Open in new window

Avatar of ITCity

ASKER

Yes it is named index.php.


Below is the results from php -v


PHP Warning:  Module 'bz2' already loaded in Unknown on line 0
PHP Warning:  Module 'ctype' already loaded in Unknown on line 0
PHP Warning:  Module 'curl' already loaded in Unknown on line 0
PHP Warning:  Module 'dom' already loaded in Unknown on line 0
PHP Warning:  Module 'ftp' already loaded in Unknown on line 0
PHP Warning:  Module 'iconv' already loaded in Unknown on line 0
PHP Warning:  Module 'mysql' already loaded in Unknown on line 0
PHP Warning:  Module 'openssl' already loaded in Unknown on line 0
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
PHP Warning:  Module 'posix' already loaded in Unknown on line 0
PHP Warning:  Module 'session' already loaded in Unknown on line 0
PHP Warning:  Module 'SimpleXML' already loaded in Unknown on line 0
PHP Warning:  Module 'soap' already loaded in Unknown on line 0
PHP Warning:  Module 'sockets' already loaded in Unknown on line 0
PHP Warning:  Module 'tokenizer' already loaded in Unknown on line 0
PHP Warning:  Module 'xml' already loaded in Unknown on line 0
PHP Warning:  Module 'xmlreader' already loaded in Unknown on line 0
PHP Warning:  Module 'xmlwriter' already loaded in Unknown on line 0
PHP Warning:  Module 'zip' already loaded in Unknown on line 0
PHP Warning:  Module 'zlib' already loaded in Unknown on line 0
PHP Warning:  Module 'SQLite' already loaded in Unknown on line 0
PHP Deprecated:  Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0

Deprecated: Directive 'register_globals' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP Deprecated:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0

Deprecated: Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP 5.3.8 (cli) (built: Dec  8 2011 23:01:40)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
please do the following other commands for me:
ps ax | grep tpd
locate libphp5

Open in new window

Avatar of ITCity

ASKER

when I do a pkg_info I get the following below.
Can it be that I am going to have to delete the packages that have 5.1.6 inorder for php to use the new php 5.3.8?

php5-5.3.8          PHP Scripting Language
php5-bz2-5.1.6      The bz2 shared extension for php
php5-bz2-5.3.8      The bz2 shared extension for php
php5-ctype-5.1.6    The ctype shared extension for php
php5-ctype-5.3.8    The ctype shared extension for php
php5-curl-5.1.6     The curl shared extension for php
php5-curl-5.3.8     The curl shared extension for php
php5-dom-5.1.6      The dom shared extension for php
php5-dom-5.3.8      The dom shared extension for php
php5-extensions-1.6 A "meta-port" to install PHP extensions
php5-filter-5.3.8   The filter shared extension for php
php5-ftp-5.1.6      The ftp shared extension for php
php5-ftp-5.3.8      The ftp shared extension for php
php5-gd-5.1.6       The gd shared extension for php
php5-hash-5.3.8     The hash shared extension for php
php5-iconv-5.1.6    The iconv shared extension for php
php5-iconv-5.3.8    The iconv shared extension for php
php5-json-5.3.8     The json shared extension for php
php5-mysql-5.1.6    The mysql shared extension for php
php5-mysql-5.3.8    The mysql shared extension for php
php5-openssl-5.1.6  The openssl shared extension for php
php5-openssl-5.3.8  The openssl shared extension for php
php5-pdo-5.3.8      The pdo shared extension for php
php5-pdo_sqlite-5.3.8 The pdo_sqlite shared extension for php
php5-phar-5.3.8     The phar shared extension for php
php5-posix-5.1.6    The posix shared extension for php
php5-posix-5.3.8    The posix shared extension for php
php5-session-5.1.6  The session shared extension for php
php5-session-5.3.8  The session shared extension for php
php5-simplexml-5.1.6 The simplexml shared extension for php
php5-simplexml-5.3.8 The simplexml shared extension for php
php5-soap-5.1.6     The soap shared extension for php
php5-soap-5.3.8     The soap shared extension for php
php5-sockets-5.1.6  The sockets shared extension for php
php5-sockets-5.3.8  The sockets shared extension for php
php5-sqlite-5.1.6   The sqlite shared extension for php
php5-sqlite-5.3.8   The sqlite shared extension for php
php5-tokenizer-5.1.6 The tokenizer shared extension for php
php5-tokenizer-5.3.8 The tokenizer shared extension for php
php5-xml-5.1.6      The xml shared extension for php
php5-xml-5.3.8      The xml shared extension for php
php5-xmlreader-5.1.6 The xmlreader shared extension for php
php5-xmlreader-5.3.8 The xmlreader shared extension for php
php5-xmlwriter-5.1.6 The xmlwriter shared extension for php
php5-xmlwriter-5.3.8 The xmlwriter shared extension for php
php5-zip-5.3.8      The zip shared extension for php
php5-zlib-5.1.6     The zlib shared extension for php
php5-zlib-5.3.8     The zlib shared extension for php
ASKER CERTIFIED SOLUTION
Avatar of xterm
xterm

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of ITCity

ASKER

pkg_delete php5-zlib-5.1.6
pkg_delete php5-xmlwriter-5.1.6
pkg_delete php5-xmlreader-5.1.6
pkg_delete php5-bz2-5.1.6

and so on and so on.  I was going to do each one, one at a time.

thanks,
Avatar of ITCity

ASKER

or I think this command may work.  

pkg_delete php5*-5.1.6
please do the following other commands for me before you start deleting the old packages.
ps ax | grep tpd
locate libphp5

Open in new window

Avatar of ITCity

ASKER

1.  output
  553  ??  Is     0:01.00 /usr/libexec/ftpd -Dll
15254  ??  S      0:00.49 /usr/local/sbin/lighttpd -f /usr/local/etc/lighttpd.conf
15921  p0  S+     0:00.00 grep tpd


2.  No out put on the second command

Okay... that looks good.  Alright, let's try removing the 5.1.6 packages and see if it will let you.  You may have to do a 'make reinstall' on the new version afterwards though if it accidentally deletes some stuff from the 5.3.8 ones.  The ports collection can be funny sometimes.
Avatar of ITCity

ASKER

i got the solution.  I had to kill the php process when i shut down lighttpd.

Thank you for the help....  I will award the points
Wow, well that explains it - I figured php would die when lighttpd went down - that's why I kept asking you if you were 100% sure you restarted it :)

Good to know, thanks.