Problems and Solutions for building lamp and phpredisadmin in centos 6

Source: Internet
Author: User
Document directory
  • 1. install Apache in yum
  • 2. Install MySql in yum
  • 3. install Apache in yum
  • 4. Install phpredis in source code

Recently, reids has been used in the project. to simplify the work of testers, we are preparing to build phpredisadmin with a 64-bit centos6.0 environment. Although I know little about Linux, I wanted to build a lamp environment and install a PHP website so easy. However, it took me several days to complete the process. I would like to share with you some of the writing problems encountered in the process and solutions: At the beginning, I used the source code for installation, and I still failed to solve a lot of problems. Finally, lamp was installed with Yum and encountered a lot of problems. The following is a bit messy and I am too lazy to sort it out and paste it directly.

1. install Apache in yum

Install Apache on centos6.0 for various reasons, first install Apache through yum, then install Apache through source code, and then uninstall Apache for various reasons. There is a problem at this time. For source code installation, I directly Delete the installation directory/usr/local/apache2. Then, use Yum remove httpd to delete the yum installation. The system prompts that the deletion is successful, but when I use Yum install httpd to verify whether the deletion is successful, the system always prompts that I have installed Apache. Because yum is not installed properly, I don't know which files are installed and which directory the files are installed in. Therefore, deleting files one by one is not displayed.
Finally, you can use rpm-Qa | grep httpd to check which Apache dependent RPM packages are installed. Enter the following:
Httpd-tools-2.2.15-15.el6.centos.1.x86_64
Httpd-2.2.15-15.el6.centos.1.x86_64
Then, use rpm-e to delete these dependencies, but the problem occurs again. The system error prompt is as follows:
Error reading information on service httpd: no such file or directory
Error: % preun (httpd-2.2.15-15.el6.centos.1.x86_64) scriptlet failed, exit status 1
At last, I couldn't help Gu's brother and Du Niang again. Finally, I found another RPM parameter-noscripts:
Finally, the above two packages were deleted through rpm-e -- noscripts.
Run the yum install httpd command again. OK.
Ah, I know little about Linux, and it's easy to figure it at the beginning. After yum is installed, I will manually compile and install the source code myself. Although complicated, the customization is strong.

2. Install MySql in yum

First, install MySQL. Open the Super Terminal and enter:

[Root @ localhost ~] # Yum install MySQL mysql-Server
After installation, MySQL can be automatically started with the system:
[Root @ localhost ~] # Chkconfig -- levels 235 mysqld on
[Root @ localhost ~] #/Etc/init. d/mysqld start
Set the password for the root account of Mysql Data:
[Root @ localhost ~] # Mysql_secure_installation
However, the following error occurs: Can't connect to local MySQL server through socket '/var/lib/MySQL. Sock' (2 ).
I finally found that MySQL exists in my/tmp. sock but the directory to be searched is/var/lib/MySQL, which does not contain MySQL. sock, so we made a link ln-S/tmp/MySQL. sock/var/lib/MySQL. sock solved the problem. However, I still wonder why mysql. Sock is located in/var/lib/MySQL when MySQL is installed in yum. But the path configured in the configuration file my. CNF is/tmp/MySQL. Sock.

3. install Apache in yum

[Root @ localhost ~] # Yum install httpd
Configure the system to enable Apache with the system:
[Root @ localhost ~] # Chkconfig -- levels 235 httpd on
After the configuration is complete, start Apache:
[Root @ localhost ~] #/Etc/init. d/httpd start
At this time, I encountered another problem:
Starting httpd: cocould not reliably determine the server's fully qualified domain name, using 192.168.33.225 for servername
(98) address already in use: make_sock: cocould not bind to address [:]: 80
(98) address already in use: make_sock: cocould not bind to address 0.0.0.0: 80
No listening sockets available, shutting down
Restart the system.
You can use netstat-LNP | grep 80 to check which processes occupy port 80.
You can use the ps pid Method to view a specific process.
Then use the kill-9 PID to kill the process that occupies port 80.

4. Install phpredis in source code

To install phpredisadmin, you need to install PHP's redis extension phpredis. However, if you install phphou through yum, you cannot find phpize. phpzie is used to install PHP extensions. If you cannot find phpredis, you cannot install phpredis. finally, we found that phpize belongs to PHP-devel. After Yum install PHP-devel, it is found that phpize appears in the/usr/bin directory.

After installing phpize, start to install phpredis:

Download the tar package of phpredis, decompress it, and start installation:
[Root @ junlings/] # cd/usr/local/src
[Root @ junlings SRC] # cd phpredis/
[Root @ junlings phpredis] # cd owlient-phpredis-90ecd17/
[Root @ junlings owlient-phpredis-90ecd17] #/usr/bin/phpize
Processing ing:
Php api version: 20090626
Zend module api no: 20090626
Zend extension api no: 220090626
[Root @ junlings owlient-phpredis-90ecd17] #./configure-with-PHP-Config =/etc
At this time, another problem occurs, saying: Configure: Error: cannot find PHP-config. Please use -- With-PHP-Config = path
However, the PHP configuration file is in the/etc directory according to the information I typed in phpinfo. However, the php. ini file was not found in the directory CD to/etc. The file PHP. INI is not found in the system through find.

So I tried to directly./configure and directly make & make install and then prompted redis. So to be installed in/usr/lib64/PHP/modules /. However, redis support information is not displayed on the phpinfo page after Apache is restarted. /Etc does not have PHP. ini, So I manually created a line of extension = "redis. So", restarted Apache, refreshed the page, OK, and finally saw redis ...... Write a redis test page:
<? PHP
$ Redis = new redis ();
$ Redis-> connect ('192. 168.32.13 ', 192 );
$ Redis-> set ('test', 'Hello redis word! ');
Echo $ redis-> get ('test ');
?>
View "Hello redis word !" This indicates that the redis extension is successfully installed.

Then install phpredisadmin. Looking back, although it was not smooth, the basic Linux commands were all incorrect. Thank you for your failure ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.