Created
October 10, 2017 21:46
-
-
Save rafrancoso/3234a38aa74212836cfd8c36f56cd890 to your computer and use it in GitHub Desktop.
Configure Debian\Mint\Ubuntu Apache PHP7.1 Mysql and Oracle Client environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#MySql | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password 123' | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password 123' | |
apt-get install -y mysql-server | |
mysql -uroot -p123 -e "CREATE USER 'user'@'%' IDENTIFIED BY 'pass';" | |
mysql -uroot -p123 -e "GRANT ALL ON *.* TO 'user'@'%';" | |
#Allow external connection | |
#Mint/Ubuntu Version | |
#-sed -i "/^bind-address*/s/^/#/g" /etc/mysql/mysql.conf.d/mysqld.cnf | |
#Debian 9 | |
sed -i "/^bind-address*/s/^/#/g" /etc/mysql/mariadb.conf.d/50-server.cnf | |
service mysql restart | |
#Apache2 | |
apt-get install -y apache2 | |
a2enmod rewrite | |
sed -i "13i \ \ \ \ \ \ \ \ <Directory /var/www>\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Options Indexes FollowSymLinks MultiViews\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #AllowOverride All\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ AllowOverride FileInfo\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Order allow,deny\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ allow from all\n\ \ \ \ \ \ \ \ </Directory>\n" /etc/apache2/sites-available/000-default.conf | |
#php 7.1 | |
#Mint\Ubuntu version | |
# add-apt-repository -y ppa:ondrej/php | |
# Debian version | |
apt-get install -y apt-transport-https lsb-release ca-certificates | |
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg | |
sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' | |
# Debian version | |
apt-get update | |
apt-get install -y php7.1-mysql php7.1-curl php7.1-json php7.1-cgi php7.1 libapache2-mod-php7.1 php7.1-mbstring php7.1-pgsql php7.1-gd | |
echo "<?php phpinfo()?>" > /var/www/html/info.php | |
sed -i "s/short_open_tag = .*/short_open_tag = On/" /etc/php/7.1/apache2/php.ini | |
sed -i "s/short_open_tag = .*/short_open_tag = On/" /etc/php/7.1/cli/php.ini | |
service apache2 restart | |
#oci8 | |
download oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm from oracle site | |
download oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm from oracle site | |
apt-get install -y php7.1-dev build-essential php-pear libaio1 alien | |
alien -i oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm | |
alien -i oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm | |
yes '' | pecl install oci8 | |
echo "extension=oci8.so" > /etc/php/7.1/mods-available/oci8.ini | |
ln -s /etc/php/7.1/mods-available/oci8.ini /etc/php/7.1/apache2/conf.d/oci8.ini | |
ln -s /etc/php/7.1/mods-available/oci8.ini /etc/php/7.1/cli/conf.d/oci8.ini | |
service apache2 restart | |
navigate to youripaddress/info.php to see results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Caso ocorrer o erro libmql1.so: cannot open shared object file: No such file or directory in Unknown on line 0
Adicionar a pasta de libs na configuração, algo como o script abaixo, tem que achar o diretório correto.
sudo sh -c "echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-instantclient.conf" sudo ldconfig