Linux installation Apache environment and problems encountered in solving

Source: Internet
Author: User
Tags fpm ldap mcrypt centos

Recently work to take some projects, are Linux under the Apache environment, originally wanted to run directly nginx, helpless, have used a lot of rewrite,apache and nginx in rewrite some grammar is not the same, do not want to change these rules, And then installed a set of Apache environment on the same server.

The first thought is the lazy way, so that a set of PHP support both Apache and PHP-FPM, but in configure will be an error. The general content of the error is that only two choose one. So the nginx of the previous set of circumstances do not move her.

http://httpd.apache.org/under the httpd2.2,
./configure--PREFIX=/USR/LOCAL/HTTPD
Make && make install

Apr those can not be fitted.

Then recompile PHP in the previous PHP directory.
  Modify compilation parameters
./configure--prefix=/usr/local/php_httpd--with-config-file-path=/usr/local/php_httpd/etc-- With-apxs2=/usr/local/httpd/bin/apxs--with-mysql--with-mysqli=/usr/local/mysql/bin/mysql_config-- With-iconv-dir--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir-- Enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--with-curlwrappers-- Enable-mbregex--enable-mbstring--with-mcrypt=/usr/local/mcrypt--with-gd --enable-gd-native-ttf-- With-openssl--with-mhash--enable-pcntl--enable-sockets--with-ldap--WITH-LDAP-SASL- Enable-soap--with-pear  --enable-pdo--with-pdo-mysql--with-gettext--enable-exif-- Enable-calendar--enable-ftp --enable-dba--enable-sysvmsg --enable-sysvshm--enable-debug-- enable-maintainer-zts --with-pcre-regex--enable-gd-jis-conv--enable-sockets

Remove--ENABLE-FPM--enable-embed--with-fpm-user=www--with-fpm-group=www
--enable-embed=type builds an embedded SAPI library. parameter is shared, static

Make && make install

So far, the Apache environment has been set up. MySQL shared the nginx of the set.

/usr/local/httpd/bin/apachectl start
Then change the port and let Apache run.

OK, everything is fine. Centos.

But local centos are not going well. The display PHP file is not parsed.
Add the following three sentences:
AddType Application/x-httpd-php-source. Phps
AddType application/x-httpd-php. php. phtml. php3
LoadModule Php5_module modules/libphp5.so

Reboot, error libphp5.so found, find/-name ' libphp5.so '
The path module/libphp5.so of the CP lookup
Restart the error again. No permissions.
Chcon-t textrel_shlib_t libphp5.so
SELinux caused, you can directly close the SELinux.

Reboot again, OK. If you set the port number too large, you will also get an error.
Or the selinux caused it. Set 81 If the SELinux is open.

It turns out that Apache has no mod_rewrite modules.
Find/-name mod_rewrite.c//Search for mod_rewrite.c files in Apache source installation directory
CD path/to/mod_rewrite.c//Enter the directory containing MOD_REWRITE.C files
/usr/local/httpd/bin/apxs-c mod_rewrite.c//apxs should specify an absolute path in the bin directory where you are currently using Apache
/usr/local/httpd/bin/apxs-i-a-n mod_rewrite mod_rewrite.la
If nothing is wrong, you should compile a mod_rewrite.so file in your Apache modules directory.

Edit the httpd.conf file to confirm that the httpd.conf already contains the mod_rewrite.so load statement.
LoadModule Mod_rewrite_module modules/mod_rewrite.so
Modified to:
LoadModule Rewrite_module modules/mod_rewrite.so
At this point, your Apache should have supported rewrite.
No modification will be an error:
Can ' t locate API module structure ' mod_rewrite_module ' in file/usr/local/apache2/modules/mod_rewrite.so:undefined Symbol "Mod_rewrite_module"

Related Article

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.