Installing PHP


5 posts
by spaceman » Sun Dec 30, 2012 8:43 pm
I want to install PHP, but it looks like apt-get wants to install Apache at the same time. Is it possible to get PHP without Apache? (I already installed Nginx based on other recommendations on this site.)

Code: Select all
pi@raspberrypi ~ $ sudo apt-get install php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libonig2 libqdbm14 php5-cli php5-common
  ssl-cert
Suggested packages:
  apache2-doc apache2-suexec apache2-suexec-custom php-pear openssl-blacklist
The following NEW packages will be installed:
  apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libonig2 libqdbm14 php5 php5-cli
  php5-common ssl-cert
0 upgraded, 15 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,052 kB of archives.
After this operation, 21.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.
pi@raspberrypi ~ $


Also, how do I find out which version of PHP this will install?
Posts: 5
Joined: Tue Jan 03, 2012 9:06 am
by azeam » Sun Dec 30, 2012 9:24 pm
Check out php5-fpm for use with nginx, there are several detailed tutorials if you google. "-V" will give you the version number, for example
Code: Select all
sudo apt-get install php5-fpm -V
User avatar
Posts: 192
Joined: Fri Oct 26, 2012 11:13 pm
by spaceman » Sun Dec 30, 2012 10:21 pm
I installed php5-cli (instead of php5) which installed PHP 5.4.4-10. PHP has a built-in web server for development work. "php -S 0.0.0.0:8080"

azeam wrote:Check out php5-fpm for use with nginx, there are several detailed tutorials if you google. "-V" will give you the version number, for example
Code: Select all
sudo apt-get install php5-fpm -V


lower case "-v" gives me apt-get's version number.
upper case "-V" doesn't appear to do anything.

I'll take a look at php5-fpm next. Thanks!
Posts: 5
Joined: Tue Jan 03, 2012 9:06 am
by azeam » Mon Dec 31, 2012 1:54 am
lower case "-v" gives me apt-get's version number.
upper case "-V" doesn't appear to do anything.

That's odd, it should give you the version number (within parentheses), output on my Xubuntu desktop:
Code: Select all
sudo apt-get install php5-fpm -V
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
   php5-common (5.4.6-1ubuntu1.1)
Suggested packages:
   php-pear (5.4.6-1ubuntu1.1)
The following NEW packages will be installed:
   php5-common (5.4.6-1ubuntu1.1)
   php5-fpm (5.4.6-1ubuntu1.1)
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,128 kB of archives.
After this operation, 9,341 kB of additional disk space will be used.
Do you want to continue [Y/n]?
User avatar
Posts: 192
Joined: Fri Oct 26, 2012 11:13 pm
by spaceman » Mon Dec 31, 2012 4:47 am
-V works now. not sure what I did wrong last time.

I got php-fpm working as well. Thanks for your help.
Posts: 5
Joined: Tue Jan 03, 2012 9:06 am