Php

From vpsget wiki
Revision as of 22:57, 19 November 2013 by Vq (talk | contribs)
Jump to: navigation, search

To install php on Centos enter following command:

yum install php

To install php-mysql:

yum install php-mysql

Locate working php.ini:

php -i | grep 'Configuration File'

Create file phpinfo.php in web accessible directory, for example /var/www/html:

nano /var/www/html/phpinfo.php

Add following to the file and save it:

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

Now you can display php details using url http://YourIP/phpinfo.php

If you want to recompile php you can copy your current php settings under "Configure Command" in http://YourIP/phpinfo.php

Download source of your current php version, cd to the extracted folder and execute:

./configure --with-apxs2=/usr/bin/apxs2 --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config --with-pgsql=/usr --with-tidy=/usr --with-curl=/usr/bin --with-curlwrappers --with-openssl-dir=/usr --with-xpm-dir=/usr --with-pdo-pgsql=/usr --with-pdo-mysql=/usr --with-xsl=/usr --with-ldap --with-xmlrpc --with-iconv-dir=/usr --with-snmp=/usr --enable-exif --enable-calendar --with-bz2=/usr --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr --enable-zip --with-pear

This is an example command, you should edit components according to your needs. After configuring is accomplished, enter:

make
make install

Installing php5.5 with yum:

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install php55w-devel php55w-mbstring php55w-mcrypt php55w-gd php55w-mysql php55w-xml