I have listed all the steps as if you have selected 'minimum installation' for Centos 7, that way I should cover most people's setups on Centos, as no dependencies are assumed. I'm not a Linux guru, so some steps may seem unnecessary.
Yum install net-tools.
- Allows ifconfig to check IP address (useful if it's a local VM).
Yum install php
- Installs php version 5.4.16 (you might have an error with PHP 5.5 and greater. You can check what php version will be installed by running yum info php
Yum install php-mysql
- Installs mysql and the pdo extensions php requires for many things.
yum install php-pear
- install php-pear
installing pear allows pecl command.
Yum install php-devel
- To install libevent, you will need the command phpize, php-devel contains this.
Yum install gcc
- You will also need C compiler to install libevent, which gcc provides.
Yum install libevent-devel
- This installs the libevent ‘headers’ that pecl install libevent requires.
Pecl install libevent
- This will actually result in error, but is useful in giving you the channel url to use instead, currently channel://pecl.php.net/libevent-0.1.0
Pecl install channel://pecl.php.net/libevent-0.1.0
- This is the final step that will (hopefully) install libevent without any errors.
Add extension=libevent.so
to php.ini
- Although libevent is installed, you need to tell php to reference it on startup.
Apachectl restart
- Restarts apache / php
sudo iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
- this will allow connections from web browser.
Can now check it’s there by looking up ‘libevent’ by running <?php phpinfo(); ?>
By default, web files should go in /var/www/html
.