Build a php environment in linux

Source: Internet
Author: User
: This article describes how to set up the php environment in linux. if you are interested in the PHP Tutorial, refer to it. 1. install mysql and zlib

Problem Records

1. configure: error: Cannot find MySQL header files under/usr/include/mysql.
Note that the MySQL client library is not bundled anymore!
Prompt that MySQL header files cannot be found
I checked it online and used find/-name mysql. h to check whether/usr/include/mysql. h exists.
My mysql is installed using the official rpm Package
Server client devel share-compat is installed...
I am very grateful for the introduction to the linux field.

Oh, it is estimated that most of the problems are 64-bit. The problems encountered when installing software on 64-bit are often caused by the Library path problem. The problem can be solved by running dongboemil. Either PHP specifies the pre-configuration parameter MYSQL library path, or it is to copy the MYSQL library or soft link to the default directory in PHP.

-With-mysql =/usr/include/mysql, this parameter should be incorrect,
Change it
-- With-mysql
Or
-- With-mysql =/usr
Try
Because you installed MYSQL at RPM, which is based on the system path.
If the problem persists
Note that the configuration is re-configured every time, first like this:
Make clean
Re-configure and compile

2,

The configure: error: mysql configure failed. Plea error occurs when PHP is compiled and installed.

Php has not been compiled and installed for a long time. to play with nginx, you can compile it once for testing. 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-Cenable-mbregex Cenable-fastcgi Cenable-force-cgi-redirect Cenable-mbstring Cwith-mcrypt
I did not expect the following errors

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 has been talking about the following answer for a long time: Dizzy. this is also called the answer. I don't have to re-compile mysql. This php is very troublesome. this must be wrong.

When installing PHP, I did not specify the mysql installation directory. But I have already specified this, so this statement is incorrect. The main reason is that mysql-level is not installed, that is, the mysql version is incorrect.
Mysql-max-5.0.21 version (software packages that contain 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"

Check the error message in config. log .... Oh. it turns out that there is a problem with the version. I think my system is X86, and lib is 64-bit. so the solution is very easy.
This libmysqlclient. a library is in/usr/lib64/mysql, not in/usr/lib/mysql.
So we can do the following to solve the problem:

# Export LDFLAGS =-L/usr/lib64/mysql
OR
In Makefile
-L/usr/lib/mysql
Change
-L/usr/lib64/mysql


The above describes how to set up the php environment in linux, including some content, and hope to help those who are interested in the PHP Tutorial.

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.