Home  >  Article  >  Backend Development  >  Building php environment under linux

Building php environment under linux

WBOY
WBOYOriginal
2016-08-08 09:24:591943browse

1. Install mysql, zlib, etc.

Problem record

1. configure: error: Cannot find MySQL header files under /usr/include/mysql.
Note that the MySQL client library is not bundled anymore!
Prompt me to find I couldn’t find the MySQL header files
I checked online and used find / -name mysql.h to find that /usr/include/mysql/mysql.h does exist
My mysql was installed with the official rpm package
server client devel share -compat is all installed...
I am new to the Linux field and I am asking for some advice. I would be very grateful

Oh, I guess it is mostly a 64-bit problem. Problems encountered when installing software on 64-bit systems are often caused by library paths. The problem should be solved by pressing dongboemil. Either PHP specifies the preconfigured parameter MYSQL library path, or the MYSQL library is copied or soft-linked to the directory that PHP looks for by default.

-with-mysql=/usr/include/mysql, this parameter should be wrong,
change it to
--with-mysql
or
--with-mysql=/usr
Try it
because your MYSQL is RPM Install it according to the system path
If it still doesn’t work, please note that every time you re-preconfigure, do this first:
make clean
Then re-preconfigure and compile

2,

compile and install PHP and a configure: error appears : mysql configure failed. Plea

I haven’t compiled and installed php for a long time. In order to play with nginx. I have no choice but to compile it once to test. The compilation parameters I added are:

# ./configure Cprefix=/usr/local/php Cwith-config-file-path=/etc Cwith-gd Cenable-gd-native-ttf Cwith-mysql Cwith-iconv-dir Cwith-freetype-dir Cwith-jpeg-dir Cwith-png-dir Cwith-zlib Cwith-libxml- dir Cenable-xml Cdisable-debug Cdisable-rpath Cenable-discard-path Cenable-safe-mode Cenable-bcmath Cenable-shmop Cenable-sysvsem Cenable-inline-optimization Cwith-curl Cwith-curlwrappers Cenable-mbregex Cenable-fastcgi Cenable-force-cgi-redirect Cenable-mbstring Cwith-mcrypt

Unexpectedly, the following error always occurs

checking for mysql_close in -lmysqlclient… no

checking for mysql_error in -lmysqlclient… no
configure: error: mysql configure failed. Please check config.log for more information.

google for a long time , they all talk about the following answers, halo, this is also called the answer, then I have to recompile mysql. This PHP is very troublesome. This must be wrong.

A search on the Internet said: Mysql was not specified when installing PHP installation directory. But I have already specified it, so this statement is wrong. In fact, the main reason is that mysql-level is not installed, that is, the version of mysql is wrong. You should change it to version

mysql-max-5.0.21 (a software package that contains all mysql-related content) )

/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient

/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 59854 "configure"
#include "confdefs.h"

Looking at config The error in the .log prompt... Oh, it turns out that there is a problem with the version. I remembered that my systems are all X86 and the libs are all 64-bit. So the solution is very easy.

This libmysqlclient.a library is in /usr/lib64/ mysql, is not in /usr/lib/mysql.
So you can do the following method to solve it

#export LDFLAGS=-L/usr/lib64/mysql

OR
Please change
-L/usr/lib/ in the Makefile mysql
changed to
-L/usr/lib64/mysql


The above introduces the establishment of PHP environment under Linux, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn