最近博主配置了自己的CentOS云服务器的php环境,期间遇到了不少困难,查询了许多资料才得以解决,在此写下博客以记录。
apachectl -v
yum install mysql yum install mysql-server yum install mysql-devel
No package mysql-server available. Error: Nothing to do
yum install mariadb-server mariadb
systemctl start mariadb
mysql -u root -p
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install mysql-community-server
service mysqld restart
mysql -u root
set password for 'root'@'localhost' =password('password');
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install epel-release rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
[root@VM_120_39_centos ~]# php --version PHP 5.6.21 (cli) (built: Apr 28 2016 07:39:37) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
vim /etc/httpd/conf/httpd.conf
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
service httpd restart
<?php $conn=mysql_connect('localhost','root',''); if ($conn) echo "Connect Success..."; else echo "Connect Failure..."; phpinfo(); ?>