Saturday, September 23, 2017

Apache, MySQL and PHP installation in CentOS 7

Install Apache

# sudo yum install httpd

# sudo systemctl start httpd.service

if you are not able view in local network, then you have to check firewall

# systemctl stop firewalld

# systemctl start firewalld

# systemctl status firewalld

# systemctl enable firewalld

#systemctl disable firewalld

http://your server ip

you can get testing 123... page

# sudo systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

this is the command to find your server ip

# ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
192.168.1.108
fe80::107d:20f:bc31:73bd

and this is the site we can view our public IP
# curl http://icanhazip.com
123.456.789.18

------------------------------
Install MYSQL

#wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
#sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
#yum update

#sudo yum install mysql-server
#sudo systemctl start mysqld

# sudo systemctl enable mysqld.service

# mysqladmin -u root password '******'

#mysql -u root -p
password:

mysql>

-------------------------
Install php

# sudo yum install php php-mysql

  yum install php php-gd
  yum install php php-mbstring
  yum install php php-mysqlnd
  yum install php php-ldap
  yum install php php-imap
  yum install php php-snmp
  yum install php php-common

# yum search php-
.
.
.
php-process.x86_64 : Modules for PHP script using system process interfaces
php-pspell.x86_64 : A module for PHP applications for using pspell interfaces
php-recode.x86_64 : A module for PHP applications for using the recode library
php-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
php-xml.x86_64 : A module for PHP applications which use XML
php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol


# yum info php-xmlrpc.x86_64
.
.
.
Name        : php-xmlrpc
Arch        : x86_64
Version     : 5.4.16
Release     : 42.el7
Size        : 68 k
Repo        : base/7/x86_64

# sudo vi /var/www/html/info.php

<?php phpinfo(); ?>

save the file

# sudo systemctl restart httpd.service

now you can check your php details



http://server ip/info.php

No comments:

Post a Comment