Introduction
Good afternoon, to all readers of Habra. I would like to tell all of you a very simple and fast way to assemble a virtual machine with a php-demon and not overload your resting and celebrating brain. Often, working or home computers for some reason, religious or political reasons, installed Windows. Putting php or nginx on it is a thankless task, and if there is a need to work with phpdaemon, there are no options left. Need a nix system.
This article does not cover the questions why I chose Ubuntu, not Debian, why use phpdaemon and not php-fpm, etc. It is possible that someone will have to face a similar problem and if this article will allow you to save valuable time and spend it with your family or at work, then my task is completed successfully.
Go!
- 1. We put on our system VirtualBox, I think there will be no problems for anyone here ( download here ).
- 2. Download the fresh image of Ubuntu ( select here )
- 3. In VirtualBox, create a virtual machine for Ubuntu and install the system there
So, the initial stage is completed, by this time we should have VirtualBox with Ubuntu 10.10 virtual machine on our computer.
Small tuning ubuntu
I don’t need a Gnome at work, so you can turn off the Ubuntu GUI so that it doesn’t eat our computer’s resources. Surely there are many ways to do this, I used this:
')
sudo nano /etc/init/gdm.conf
further comment lines
#start on (filesystem
# and started hal
# and tty-device-added KERNEL=tty7
# and (graphics-device-added or stopped udevtrigger))
CTRL + O saves changes to the file. CTRL + X will exit it.
After restarting the virtual machine, the Dwarf will not start. But if you want, you can run it with the
startx command.
The next step is to set a password for the root in order not to use sudo every time.
sudo passwd root
We put phpdaemon
Install php, libevent and pear:
apt-get install php5-cli php5-dev
apt-get install libevent-dev
apt-get install php-pear
Now you need to install 2 pecl extensions. Put on the commands they refuse, citing the lack of stable versions. Therefore, simply copy the link that they themselves offer instead of the name of the package.
pecl install libevent (pecl install channel://....)
pecl install proctitle (pecl install channel://....)
We put Git, it will be needed to pull out fresh rankit and phpdemona.
apt-get install git-core
We pull, set and collect runkit.
cd /opt
git clone git://github.com/zenovich/runkit.git
cd runkit
phpize
./configure --enable-runkit --enable-modify
make
make install
Now configure php:
nano /etc/php5/cli/conf.d/phpdaemon.ini
extension=/usr/lib/php5/20090626+lfs/libevent.so
extension=/usr/lib/php5/20090626+lfs/proctitle.so
extension=runkit.so
runkit.internal_override=1
Please note that libevent.so and proctitle.so will be located where there is no machine, so you will have to specify the full path to the socks.
Now it remains only to install phpdaemon itself:
cd /opt
git clone git://github.com/kakserpom/phpdaemon.git
ln -s /opt/phpdaemon/bin/phpdaemon /usr/bin/phpd
Simlink was created solely for convenience. Well, there remains a small detail - to set the right to execute.
chmod +x /opt/phpdaemon/bin/phpdaemon
Now you can try to start the demon.
phpd start
The daemon will say something like
[PHPD] FastCGI up . This means that you did not miss a single line and followed all the instructions with precision. My congratulations.
There are no boundaries for perfection
In this configuration, it is not very convenient to work, I prefer to communicate with servers, even if they are virtual through putty. For this purpose, it is necessary to share the virtual network. The easiest way to do this:
We go to the network adapters of our virtual machine and change the type of connection to a
network bridge with our real network card. Thus, Virtualka will receive an ip-address from your dhcp server and it can be accessed at a real ip address.
You can see what address virtualka has with the command:
ifconfig eth0
In order to log in via ssh we do not forget to install openssh-server:
apt-get install openssh-server