styshoo
styshoo

Reputation: 681

How to install PHP's mysql module?

OS: Ubuntu 16.04 LTS
I use the following commands:
$ phpversion=7.1 $ apt-get update && apt-get install -y python-software-properties software-properties-common $ add-apt-repository -y ppa:ondrej/php $ apt-get update && apt-get -y install php${phpversion} php${phpversion}-mysql php${phpversion}-gd libapache2-mod-auth-tkt
After this, I install SMF bbs and phorum bbs, both of which are using php and mysql. Whene I run both of them, they both tell me that there is no mysql support in PHP.
I wonder how to install full mysql support in PHP, I'm not familar with PHP at all. Thanks a lot.

Supplement:
In fact, I use the same bbs code, same OS, install the same PHP version(7.1) in a Docker container, and everything works well. However, I run all of this in a real environment, it occurs some errors. I'm really confused. My Dockerfile is:

FROM ubuntu:16.04  
ENV LANG=C.UTF-8  
RUN apt-get update && apt-get install -y \      
    python-software-properties \  
    software-properties-common  
RUN add-apt-repository -y ppa:ondrej/php  
RUN apt-get update && apt-get -y install \  
    apache2 \  
    php7.1 \  
    php7.1-mysql \  
    php7.1-gd \  
    && rm -rf /var/lib/apt/lists/*   
ENV APACHE_RUN_USER="www-data" APACHE_RUN_GROUP="www-data" APACHE_LOG_DIR="/var/log/apache2"  
RUN rm rf /var/www/html/*  
ADD smf/ /var/www/html/  
RUN cd /var/www/html/ && chmod -R 777 *  
EXPOSE 80  

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]  

Upvotes: 0

Views: 558

Answers (1)

Difster
Difster

Reputation: 3270

You cannot have the old mysql in PHP 7.x You must use mysqli or PDO. For a complete list of all the deprecated functions in PHP 7.x, go here

Upvotes: 2

Related Questions