Add the php module for dynamic compilation and compile the php module. Add the php module for dynamic compilation and compile the php module. note: The source is www. programfish. comblog? P85 in many cases, when we build a web server in linux, we need to dynamically compile and add the php module to compile the php module.
Note: Reprint please indicate the source: http://www.programfish.com/blog? P = 85
In many cases, when we build a web server in linux, we need to compile and install the php suite, after compilation and installation, you may need to add some modules that are not specified for compilation and installation. for example:
Mysql. so, mysqli. so, mbstring. so zlib. so, and other modules.
The following message is displayed:
If you have installed phpmyadmin and opened the homepage blank after the installation and configuration, it is likely that your php does not have the mysql and mbstring modules.
When installing the wordpress plug-in online, the system prompts that the zlib plug-in is not available because zlib. so is not available in your php environment.
All of the above are my experiences, hoping to help you solve your problems.
Now, go to the topic and dynamically compile and add the php module:
Note that this blog post only discusses the linux environment with php installed.
If you do not want to add a module dynamically but want to reinstall the php environment, go:
Install Php in Linux:http://www.cnblogs.com/fly1988happy/archive/2011/12/14/2288096.html
In this case, you need to save the php source code used for compiling and installing php. If not, you can download a source code package similar to the PHP version you have installed at http://cn2.php.net/downloads.php. (the version here is the best or similar, and there may be incompatibility if the version is different ).
You also need to know where your php is installed, because you need to use the/bin/phpize tool in the installation directory.
If you do not know where your php directory is installed, you can run the find command to find the phpize file.
Lfly @ linux-oj9e: ~> Sudo find/-name phpize
Here I find my php and install it under/php.
Now, I download the source package php-5.5.18.tar.gz.
After the download is completed, decompress the package with tar-zxvf. (Needle-to-needle .tar.gz compressed package)
Lfly @ linux-oj9e :~ /Temp> tar-zxvf php-5.5.18.tar.gz
Decompress and get a php-5-5-18 folder
Then cd goes to the ext directory in the directory:
Lfly @ linux-oj9e :~ /Temp> php-5.5.18/ext
You can see many folders after listing objects by using the ls command:
These are the source code directories of the modules you want to compile. Here I assume that the mysql module is to be compiled, and we will cd it to the mysql Directory. if you want to compile other modules, then cd will be followed into the corresponding module.
Lfly @ linux-oj9e :~ /Temp/php-5.5.18/ext/mysql>/php/bin/phpize
After Cd goes in, we call the phpize script mentioned above.
What is the Phpize script?
Here we mention:
Phpize can be understood as the role of the reconnaissance environment. The phpize tool will generate the corresponding configure file based on the configuration of your installed php.
After executing this command, you may be prompted not to install the autoconf program. if so, you need to install the software and run the command again.
I have no problem here:
Use./configure-with-php-config =/php/bin/php-config
Here,/php/bin/php-config should be replaced with your Php installation directory. For example, if it is/usr/local/aaa, you can set it to/usr/local/aaa/bin/php-config.
If no error is reported after this step, run the make command.
If no error is reported when you run the make command, run the make install command.
Here, make install reports an error, because common users do not have the permission to install the compiled modules to the php installation directory.
In this case, you can run the make install command with sudo or directly switch to the root user for execution. you need to enter your password when executing the command.
Make install has two things to do after the installation is successful:
First, add the following sentence to the configuration file of php. ini:
Extension = mysql. so
It is assumed that the mysql module is compiled, and other module names are used for compiling.
For example:
If you do not know the name of the module you just compiled, you can view it in the php module directory:
I have compiled and installed four modules here.
Note: Reprint please indicate the source: http://www.programfish.com/blog? P = 85
The second thing is to restart your apache. (If you are installing apache to provide web services)
Attention: Reprint please indicate the source: http://www.programfish.com/blog? P = 85 in many cases, we will need to build a web server in linux...