How to Install LAMP on CentOS 7 in One Click

LAMP

Not long ago, CentOS was updated to CentOS 7.0.1406. To support this version, the one-click LAMP installation script underwent extensive updates and testing, and quite a few issues were encountered along the way. They are recorded here one by one.
Since CentOS 7 redirects service to systemctl
, some startup scripts had to be rewritten, and testing this process also took quite a bit of time. At the same time, some dependency packages that existed in
CentOS 6 are no longer available in CentOS 7, such as
libc-client-devel, which is a required dependency for installing the php-imap
extension. Without it, errors are inevitable when compiling PHP’s imap
extension, so the only option was to manually compile and install imap-2007f and specify the path to the imap
extension.
Some dependency packages that do not exist in either the new or old versions of CentOS were removed, such as
libmcrypt-devel, and the latest versions were all compiled and installed instead.

Some of the main updates are listed below.
1. The method for obtaining the public IP has changed
In CentOS 7, ifconfig is not installed by default, meaning the dependency package
net-tools is missing, so the original method of obtaining the IP from ifconfig was changed to using curl
with an external link to get the IP.
Therefore, before installing this script, make sure the system has network connectivity.

2. Manually install some dependency packages
These dependency packages include
pcre、libiconv、libmcrypt、mcrypt、re2c、libedit、imap。
In CentOS 5, an outdated pcre version can cause Apache compilation to fail; for MySQL
to use readline functionality, libedit must be compiled and installed; PHP’s
imap extension depends on the libc-client shared library, so imap-2007f must be compiled and installed, and so on.
Some of the error messages found online are also quite vague, especially on Chinese websites. So they are listed here as well.
Error when compiling PHP:
configure: error: utf8_mime2text() has new signature, but
U8T_CANONICAL is missing. This should not happen. Check
config.log for additional information.
This is caused by the imap extension missing dependency packages. Steps to compile and install imap-2007f:

wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
tar -zxf imap-2007f.tar.gz
cd imap-2007f
make lr5 PASSWDTYPE=std SSLTYPE=unix.nopwd EXTRACFLAGS=-fPIC IP=4
rm -rf /usr/local/imap-2007f/
mkdir /usr/local/imap-2007f/
mkdir /usr/local/imap-2007f/include/
mkdir /usr/local/imap-2007f/lib/
cp c-client/*.h /usr/local/imap-2007f/include/
cp c-client/*.c /usr/local/imap-2007f/lib/
cp c-client/c-client.a /usr/local/imap-2007f/lib/libc-client.a

Note: when compiling on 64-bit systems, the make parameter must include EXTRACFLAGS=-fPIC
; on 32-bit systems, it is not needed.
At the same time, when compiling PHP’s imap extension on CentOS 7, add the following parameters:

--with-imap=/usr/local/imap-2007f
--with-imap-ssl

When compiling on CentOS 6, since the dependency package libc-client-devel
is already installed, the parameters are as follows:

--with-imap
--with-imap-ssl
--with-kerberos

3. Add some detection functions
Added some detection functions, such as whether it is 64-bit, whether it is CentOS 7, etc.

4. Update the startup script
Apache’s startup script /etc/init.d/httpd has changed and is copied from the
/usr/local/apache/bin/apachectl file. At the same time, to make
/etc/init.d/httpd status work, the configuration file
/usr/local/apache/conf/extra/httpd-info.conf was added.

5. Possible issues on CentOS 7
After completing the LAMP installation, the website cannot be accessed via IP. Checking the processes also shows that httpd
and mysqld have started, the firewall seems to be disabled, and ping
works fine, but it is still inaccessible.
After some troubleshooting, it really does turn out to be caused by the latest firewalld
on CentOS 7. At this point, you need to use the classic iptables-services to replace
firewalld.

yum -y install iptables-services
systemctl mask firewalld
systemctl enable iptables
systemctl stop firewalld
systemctl start iptables

6. PHP component support
So far, among the one-click installation scripts for LAMP, LNMP, LANMP, and so on that I have seen, support for
PHP components is not comprehensive, and many are missing. The most typical examples are
imap and ldap.
To support these components, I made a great deal of improvements and testing. Here is a screenshot of the PHP
probe, showing support for all components, as well as 4 types of third-party components.
PHP ext

Although the LAMP
one-click installation script has already undergone extensive testing, there may still be some imperfections. If you encounter any problems during use, you can provide feedback at https://teddysun.com/lamp, submit a comment, or send an email with the installation log lamp.log to
i[at]teddysun.com.

Leave a Comment

Your email address will not be published. Required fields are marked *

中文 EN
🚀

RedGate VPN

免费节点太挤太慢?
升级高速稳定专线

立即体验 →

告别卡顿

RedGate VPN
全球高速节点

免费下载 →
Scroll to Top