Solve the call to undefined function mssql_connect error

origin:

If you want to connect to the sql server database in the project, if the mssql extension is not installed, the following error will be reported

 

At this time, first check whether the following server has the mssql extension installed

At this time, finally use phpinfo on the server to see the following 

 

 

And pay attention to this php version number

 

Because my colleague executed php -m on the server before, it showed the mssql extension

as follows

 

 

But in fact, the default php -m is the old version and PHP5.6 is used in the project

This will take a look under PHP56

Execute cd /usr/local/php56/bin

Execute php -m and find that there is no mssql extension

Find the cause of the problem and start solving

Because it was installed by compiling at that time, it is now necessary to rewrite the compilation extension

Specific steps

Find the php56 source package installed at that time

cd /user/local/src/php-5.6.4

 

Because the mssql extension was installed directly because it was in a hurry, there was no screenshot record 

 Let's take the opcache extension as a test

 
First enter the directory /usr/local/src/php-5.6.4/ext/opcache
 
Then use phpsize to generate the config command
Here you must specify the path of the correct version of php currently used on the server to execute, if you directly phpsize it will go to the old version
执 line: sudo / usr / local / php56 / bin / phpize
Then the configure command is generated
 

 

Next, use the ./configure command. If you use it directly, it will report an error type of the following picture error
 
 

 

So just follow the error prompt to write the full path

 

 
 
If you want to know if you are doing this step right, use echo $?
 
If it returns 0, the installation is correct
 

 

You can continue to execute
 
Then execute the make command
 
Use sudo make or you will get an error
 

 

Finally execute sudo make install
 
Check if the extension installation was successful
 

 

Description has been installed
You can see that mssql.so has been installed
 
Extend under php.ini configuration
 

 

 
 
restart apache
 
 

take a look

 

 

The next step is to recompile and install the required extensions.

 

 

 
 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326624158&siteId=291194637