martes, 3 de septiembre de 2024
Comparison of Web Development Frameworks: Stack Overflow 2023 vs. 2024
I always pay close attention when the Stack Overflow survey is published. Although Stack Overflow has been somewhat displaced by the inclusion of AI, it remains one of the most reliable surveys we have.
My favorite part is the web frameworks, as it helps me understand what's trending in the market. Every year, I do a small analysis comparing it with the previous year. Here is the comparison between the most popular web development frameworks according to the 2023 and 2024 surveys.
Most Popular Frameworks
In both years, Node.js and React remained the most popular frameworks, though with a slight decrease in their usage:
- Node.js: dropped from 42.65% in 2023 to 40.8% in 2024.
- React: went down from 40.58% in 2023 to 39.5% in 2024.
Likewise, jQuery, Express, and Angular also stayed among the most used, with minor variations in their percentages. Interestingly, Next.js has seen an increase in popularity, rising from 16.67% in 2023 to 17.9% in 2024.
Even though React isn't exactly my favorite library, its market position is undeniable. Year after year, it continues to lead the popularity charts, and its community keeps growing exponentially.
Long live the King! 👑
Gaining Ground
Newer frameworks like FastAPI and NestJS are rapidly gaining ground:
- FastAPI: grew from 7.42% in 2023 to 9.9% in 2024, surpassing Laravel in the rankings.
- NestJS: saw its adoption increase from 5.13% in 2023 to 5.8% in 2024.
The Newcomers
New frameworks have joined the list in 2024, and I wish them the best of luck:
- Htmx (3.3%)
- Astro (3%)
- Strapi (1.7%)
This suggests the rise of more modern and specialized technologies.
The Newcomers to the Group
New frameworks have joined FastAPI and NestJS the list in 2024, and I wish them the best of luck, folks! 🍀
- FastAPI: grew from 7.42% in 2023 to 9.9% in 2024, surpassing Laravel in the rankings.
- NestJS: increased its adoption from 5.13% in 2023 to 5.8% in 2024.
The Newcomers
New frameworks have been added to the list in 2024, and I wish them the best of luck:
- Htmx (3.3%)
- Astro (3%)
- Strapi (1.7%)
This suggests a rise in more modern and specialized technologies.
The JavaScript Ecosystem: Every Day a New Framework Is Born, and Another One Dies
The JavaScript world is famous for its constant innovation—every day, a new framework seems to emerge, and at the same time, another disappears into obscurity. Some of the technologies that were present in the 2023 survey are no longer on the 2024 list, such as Lit and Qwik, both with less than 1% usage in 2023.
How My Favorite Frameworks Fared
Django: Consistency in the Python Community
Django held steady, rising from 11.47% in 2023 to 12% in 2024.
This framework remains a favorite of mine and the Python community, especially for those seeking a complete solution for developing robust and secure web applications.
Its focus on simplicity, along with its powerful ORM and well-supported ecosystem, continues to attract developers who prioritize efficiency without sacrificing functionality.
Version 5.1 was released with minor changes, but hey, if it ain't broke, don't fix it! 😊
Django REST Framework: The Power Behind APIs in Python
While Django is popular for building web applications, when it comes to creating efficient APIs, Django REST Framework (DRF) is my top recommendation. DRF makes it easy to create scalable and secure APIs while maintaining the elegance and simplicity that defines Django.
Although lighter frameworks like FastAPI are gaining popularity, Django REST Framework remains a solid choice for those seeking seamless integration with Django for larger, more complex projects.
Laravel: A Constantly Evolving Framework
Laravel has seen a slight increase in popularity, moving from 7.58% in 2023 to 7.9% in 2024. While this growth is modest, it reflects the framework’s continued relevance in web development, especially within the PHP ecosystem.
Laravel remains the king of modern monoliths. With Livewire 3 and Inertia.js, it allows developers to build rich interfaces from the backend, keeping most of the logic on the server—a typical feature of monolithic architectures. This reinforces Laravel’s ability to speed up development without having to split the application into separate frontend and backend environments.
If you're using it to create APIs, no offense, but I recommend building your API with a faster framework 😊 (such as Lumen, FastAPI, or Express).
The announcement of Laravel Cloud, which promises to simplify cloud environment integration, is also worth noting.
With Laravel 11 on the horizon, we can expect the framework to continue improving, and perhaps, it will rise further in next year's survey. Let's see if these updates attract more developers and consolidate its growth.
Vue.js: A Slight Decline
Vue.js has seen a drop in usage, from 16.38% in 2023 to 15.4% in 2024.
It remains one of the most popular frameworks, especially for developers looking for a progressive, flexible approach to frontend development without a steep learning curve.
This decline might be attributed to the growing use of Svelte and Next.js, but Vue remains a solid option for many developers due to its ease of use and simplicity.
Ruby on Rails: Persistence in a Changing World
Ruby on Rails (RoR) dropped from 5.49% in 2023 to 4.7% in 2024, reflecting a slow but steady decline in its usage. However, it remains a beloved framework for many developers, especially those who prefer working solo.
Ruby on Rails has long been the framework of choice for developers working solo or in small teams, primarily because of its wealth of built-in tools. This enables developers to quickly create complete applications without requiring too much configuration.
Its focus on convention over configuration and productivity continues to attract those who want to develop applications quickly and efficiently.
I believe the competition from more modern frameworks may be contributing to this slight drop in popularity.
Conclusion
The results of the 2023 and 2024 Stack Overflow surveys show us how quickly developer preferences can shift, with some technologies gaining popularity while others lose relevance.
Now, if I’ve said something that doesn’t sit well with you, please forgive me! 😅 This is just my humble opinion, based on my experience and what I’ve observed. It’s important to remember that every developer has their favorite tools and approaches, and that’s what makes this field so diverse and exciting.
Stay tuned to these trends to choose the best tools for your projects.
Now, if I’ve said something that doesn’t sit well with you, please forgive me! 😅 This is just my humble opinion, based on my experience and what I’ve observed. It’s important to remember that every developer has their favorite tools and approaches, and that’s what makes this field so diverse and exciting.
To see the full survey, check out the Stack Overflow Developer Survey 2024.
Technology | 2023 (%) | 2023 Ranking | 2024 (%) | 2024 Ranking | Change |
---|---|---|---|---|---|
Node.js | 42.65% | 1 | 40.8% | 1 | ▼ |
React | 40.58% | 2 | 39.5% | 2 | ▼ |
jQuery | 21.98% | 3 | 21.4% | 3 | ▼ |
Next.js | 16.67% | 6 | 17.9% | 4 | ▲ |
Express | 19.28% | 4 | 17.8% | 5 | ▼ |
Angular | 17.46% | 5 | 17.1% | 6 | ▼ |
ASP.NET Core | 16.57% | 7 | 16.9% | 7 | ▲ |
Vue.js | 16.38% | 8 | 15.4% | 8 | ▼ |
ASP.NET | 12.79% | 10 | 12.9% | 9 | ▲ |
Flask | 12.16% | 11 | 12.9% | 9 | ▲ |
Spring Boot | 11.95% | 12 | 12.7% | 11 | ▲ |
Django | 11.47% | 13 | 12% | 12 | ▲ |
WordPress | 13.38% | 9 | 11.8% | 13 | ▼ |
FastAPI | 7.42% | 15 | 9.9% | 14 | ▲ |
Laravel | 7.58% | 14 | 7.9% | 15 | ▲ |
AngularJS | 7.21% | 16 | 6.8% | 16 | ▼ |
Svelte | 6.62% | 17 | 6.5% | 17 | ▼ |
NestJS | 5.13% | 19 | 5.8% | 18 | ▲ |
Blazor | 4.88% | 20 | 4.9% | 19 | ▲ |
Ruby on Rails | 5.49% | 18 | 4.7% | 20 | ▼ |
Nuxt.js | 3.69% | 21 | 3.6% | 21 | ⬌ |
Htmx | - | - | 3.3% | 22 | 🆕 |
Symfony | 3.2% | 22 | 3.2% | 23 | ▼ |
Astro | - | - | 3% | 24 | 🆕 |
Fastify | 2.05% | 25 | 2.2% | 25 | ▲ |
Deno | 2.36% | 23 | 1.9% | 26 | ▼ |
Phoenix | 2.04% | 26 | 1.9% | 27 | ▼ |
Drupal | 1.87% | 27 | 1.9% | 27 | ▼ |
Strapi | - | - | 1.7% | 29 | 🆕 |
CodeIgniter | 1.72% | 28 | 1.7% | 30 | ▼ |
Gatsby | 2.33% | 24 | 1.6% | 31 | ▼ |
Remix | 1.27% | 30 | 1.6% | 31 | ▲ |
Solid.js | 1.36% | 29 | 1.2% | 33 | ▼ |
Yii 2 | - | - | 0.9% | 34 | 🆕 |
Play Framework | 0.76% | 32 | 0.8% | 35 | ▼ |
Elm | 0.81% | 31 | 0.6% | 36 | ▼ |
Comparación de Frameworks de Desarrollo Web: Stack Overflow 2023 vs. 2024
Siempre estoy muy atento cuando la encuesta de Stack Overflow es publicada.
A pesar que Stack Overflow se ha visto desplazado por inclusión
de la IA, es una de las encuestas más fiables que tenemos.
Frameworks Más Populares
En ambos años, Node.js y React se mantuvieron como los frameworks más populares, aunque con una ligera disminución en su uso:
- Node.js: pasó del 42.65% en 2023 al 40.8% en 2024.
- React: bajó del 40.58% en 2023 al 39.5% en 2024.
Tendencias a la Alta
Frameworks más recientes como FastAPI y NestJS están ganando terreno rápidamente:
- FastAPI: creció del 7.42% en 2023 al 9.9% en 2024, pasando a Laravel en Ranking
- NestJS: aumentó su adopción de 5.13% en 2023 a 5.8% en 2024.
Los Nuevos del Grupo
El Ecosistema JavaScript: Cada Día Nace un Framework, y Cada Día Muere Uno
El mundo de JavaScript es famoso por su constante innovación, donde cada día parece que nace un nuevo framework y, al mismo tiempo, otro desaparece en la oscuridad. Como se puede ver algunas de las tecnologías que estuvieron presentes en la encuesta de 2023 ya no estan en la lista de 2024, como Lit y Qwik, ambos con menos del 1% de uso en 2023.
Como le fue a mis Framewok Favoritos:
Django: Consistencia en la Comunidad Python
Laravel: Un Framework Siempre en Evolución
Vue.js: Un Ligero Descenso
Ruby on Rails: Persistencia en el Mundo
Su enfoque en la convención sobre la configuración y la productividad continúa atrayendo a quienes buscan desarrollar aplicaciones de manera rápida y eficiente.
Creo que la competencia de otros frameworks modernos podría estar influyendo en esta ligera caída de popularidad.
Conclusión
Ahora bien, si he dicho algo que no te ha sentado bien, ¡discúlpame! 😅 Esto es solo mi humilde opinión, basada en mi experiencia y lo que he observado. Es importante recordar que cada desarrollador tiene sus herramientas y enfoques favoritos, ¡y eso es lo que hace que este campo sea tan diverso y emocionante!
Mantente al tanto de estas tendencias para elegir las mejores herramientas para tus proyectos..
Para revisar la encuentas completa puedes revisar en Stack Overflow Developer Survey 2024.
Tecnología | 2023 (%) | 2023 Ranking | 2024 (%) | 2024 Ranking | Cambio |
---|---|---|---|---|---|
Node.js | 42.65% | 1 | 40.8% | 1 | ▼ |
React | 40.58% | 2 | 39.5% | 2 | ▼ |
jQuery | 21.98% | 3 | 21.4% | 3 | ▼ |
Next.js | 16.67% | 6 | 17.9% | 4 | ▲ |
Express | 19.28% | 4 | 17.8% | 5 | ▼ |
Angular | 17.46% | 5 | 17.1% | 6 | ▼ |
ASP.NET Core | 16.57% | 7 | 16.9% | 7 | ▲ |
Vue.js | 16.38% | 8 | 15.4% | 8 | ▼ |
ASP.NET | 12.79% | 10 | 12.9% | 9 | ▲ |
Flask | 12.16% | 11 | 12.9% | 9 | ▲ |
Spring Boot | 11.95% | 12 | 12.7% | 11 | ▲ |
Django | 11.47% | 13 | 12% | 12 | ▲ |
WordPress | 13.38% | 9 | 11.8% | 13 | ▼ |
FastAPI | 7.42% | 15 | 9.9% | 14 | ▲ |
Laravel | 7.58% | 14 | 7.9% | 15 | ▲ |
AngularJS | 7.21% | 16 | 6.8% | 16 | ▼ |
Svelte | 6.62% | 17 | 6.5% | 17 | ▼ |
NestJS | 5.13% | 19 | 5.8% | 18 | ▲ |
Blazor | 4.88% | 20 | 4.9% | 19 | ▲ |
Ruby on Rails | 5.49% | 18 | 4.7% | 20 | ▼ |
Nuxt.js | 3.69% | 21 | 3.6% | 21 | ⬌ |
Htmx | - | - | 3.3% | 22 | 🆕 |
Symfony | 3.2% | 22 | 3.2% | 23 | ▼ |
Astro | - | - | 3% | 24 | 🆕 |
Fastify | 2.05% | 25 | 2.2% | 25 | ▲ |
Deno | 2.36% | 23 | 1.9% | 26 | ▼ |
Phoenix | 2.04% | 26 | 1.9% | 27 | ▼ |
Drupal | 1.87% | 27 | 1.9% | 27 | ▼ |
Strapi | - | - | 1.7% | 29 | 🆕 |
CodeIgniter | 1.72% | 28 | 1.7% | 30 | ▼ |
Gatsby | 2.33% | 24 | 1.6% | 31 | ▼ |
Remix | 1.27% | 30 | 1.6% | 31 | ▲ |
Solid.js | 1.36% | 29 | 1.2% | 33 | ▼ |
Yii 2 | - | - | 0.9% | 34 | 🆕 |
Play Framework | 0.76% | 32 | 0.8% | 35 | ▼ |
Elm | 0.81% | 31 | 0.6% | 36 | ▼ |
jueves, 11 de noviembre de 2021
Instalando PHP 8 y Composer 2 en Windows
Muchas personas utilizan Laragon o xampp para programar son excelentes productos, sin embargo si no deseas usar estas herramientas puedes hacerlo de manera nativa, dejo una guia.
Install PHP 8 en Windows 10
1.) Primero necesitamos instalar Visual C++ Redistributable aqui dejo 2 link para descarlo2.2.1) Cambie memory_limit de 128M a 1G (¡porque Composer puede usar mucha memoria!)
domingo, 20 de diciembre de 2020
Cómo instalar OCI8 en Ubuntu 20.04 y PHP 7.4
Cómo instalar OCI8 en Ubuntu 20.04 y PHP 7.4 Oracle client 19
Paso 1
Descargue Oracle Instant Client y SDK del sitio web de Oracle. (Necesita iniciar sesión en la página de Oracle)
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.htmlDescargar
Paso 2
Cree una nueva carpeta para almacenar archivos zip de Oracle Instant Client en su servidor.
sudo mkdir /usr/lib/oracle sudo mkdir /usr/lib/oracle/19.9 sudo mkdir /usr/lib/oracle/19.9/client64
Paso 3
Ahora necesitamos extraer los archivos.
sudo cp instantclient-basic-linux.x64-19.9.0.0.0dbru.zip /usr/lib/oracle/19.9/client64 sudo cp instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip /usr/lib/oracle/19.9/client64 sudo cp instantclient-sqlplus-linux.x64-19.9.0.0.0dbru.zip /usr/lib/oracle/19.9/client64 cd /usr/lib/oracle/19.9/client64 sudo unzip instantclient-basic-linux.x64-19.9.0.0.0dbru.zip sudo unzip instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip sudo unzip instantclient-sqlplus-linux.x64-19.9.0.0.0dbru.zip sudo mv instantclient_19_9 lib
Paso 4
A continuación, necesitamos crear un enlace simbólico a los archivos de Instant Client.
cd /usr/lib/oracle/19.9/client64/lib/ sudo ln -s libclntsh.so.19.1 libclntsh.so (Puede que ya exista) sudo ln -s libocci.so.19.1 libocci.so (Puede que ya exista)
Paso 5
Agregue la carpeta a nuestro ldconfig.sudo su - echo /usr/lib/oracle/19.9/client64/lib > /etc/ld.so.conf.d/oracle.conf
Paso 6
Actualice los enlaces de tiempo de ejecución de Dynamic Linker
ldconfig
Hecho. Ahora podemos pasar a la siguiente parte.
Instalar paquetes adicionales
Para instalar la extensión OCI8, necesitamos instalar algún paquete adicional en nuestro servidor.
Paso 1
Ejecute estos comandos:
sudo apt-get install php-dev php-pear build-essential libaio1
Paso 2
Una vez instalado, necesitamos obtener el archivo OCI8. Pero, antes de eso, necesitamos actualizar el canal PECL.
sudo pecl channel-update pecl.php.net
Luego instalaremos oci8
sudo pecl install oci8 (php 8) sudo pecl install oci8-2.2.0 (php 7.)Ver documentacion de pecl
Cuando se le solicite la ubicación del Instant Client, ingrese lo siguiente:
instantclient,/usr/lib/oracle/19.9/client64/lib
Al finalizar deberia mostrar:
Build process completed successfully Installing '/usr/lib/php/20190902/oci8.so' install ok: channel://pecl.php.net/oci8-2.2.0 configuration option "php_ini" is not set to php.ini location You should add "extension=oci8.so" to php.ini
Paso 3
Necesitamos decirle a PHP que cargue la extensión OCI8.
sudo su - sudo echo "extension=oci8.so" >> /etc/php/7.4/fpm/php.ini echo "extension=oci8.so" >> /etc/php/7.4/cli/php.ini
Paso 4
Actualiza el servidor.
sudo shutdown -r now
sudo service php7.4-fpm restart
Hasta aqui funciona el cli pero no fpm
Configurar fpm
Paso 1
cd /etc/php/7.4/mods-available/ sudo touch oci.ini sudo vi oci.iniagregar a oci.ini
extension = oci8.so
Paso 2
Ahora cree un enlace simbólico como este:
cd /etc/php/7.4/fpm/conf.d sudo ln -s /etc/php/7.4/mods-available/oci.ini 20-oci.ini
Paso 3
Actualiza el servidor.
sudo shutdown -r now
sudo service php7.4-fpm restart
Paso 4
Ahora crea un archivo php info
cd /var/www/html/ sudo touch info.php sudo vi info.php
agregar a info.php
<?php phpinfo();
Deberia mostrar la seccion oci
oci8 OCI8 Support enabled OCI8 DTrace Support disabled OCI8 Version 2.2.0 Oracle Run-time Client Library Version 19.9.0.0.0 Oracle Compile-time Instant Client Version 19.9
Configurar Sqlplus (opcional)
Paso 1
Agregando rutas al .bashrc
cd $h vi .bashrc
Agregar
export ORACLE_HOME=/usr/lib/oracle/19.9/client64 export TNS_ADMIN=/usr/lib/oracle/19.9/client64/network/admin export PATH=$PATH:$ORACLE_HOME/lib export LD_LIBRARY_PATH=$ORACLE_HOME/lib export EDITOR=vi
Paso 2
Crear el archivo tnsnames.ora
cd /usr/lib/oracle/19.9/client64 sudo mkdir /usr/lib/oracle/19.9/client64/network sudo mkdir /usr/lib/oracle/19.9/client64/network/admin cd /usr/lib/oracle/19.9/client64/network/admin sudo touch tnsnames.ora sudo vi tnsnames.ora
Agregar
orcl = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) )
Por ultimo vamos a probar
sqlplus system/system@orcl
sábado, 25 de julio de 2020
Laravel & vue reload / refresh data con timer
laravel new test_tick cd test_tick php artisan serve
Paso 2: Instalar Vue (en otra ventana)
cd test_tick composer require laravel/ui php artisan ui vue
Paso 3 : Instalar moment
npm install npm run watch
Paso 4 : Desarollando el tick
Abrimos el archivo resources/js/components/ExampleComponent.vue
Vamos hacer el metodo llenar se ejecute cada 5 segundos.
<template> <div class="container"> <div class="row justify-content-center"> <div class="col-md-8"> <div class="card"> <div class="card-header">Example Component</div> <div class="card-body"> Fecha: {{fecha}} </div> </div> </div> </div> </div> </template> <script> export default { data(){ return { fecha: new Date(), } }, mounted() { console.log('Component mounted.') this.llenar(); },//timer beforeDestroy () { clearInterval(this.intervalid1) }, created() { setInterval(this.llenar, 30000); },//fin timer methods:{ llenar(){ this.fecha= new Date(); console.log (this.fecha); }, } } </script>
Paso 5 : Habilitando VUE en Laravel Para este ejemplo vamos a reemplazar la vista resources/views/welcome.blade.php con el siguiente contenido.
<!DOCTYPE html> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Laravel</title> <!-- Scripts --> <script src="{{ asset('js/app.js') }}" defer></script> </head> <body> <div id="app"> <example-component></example-component> </div> </body> </html>
miércoles, 22 de julio de 2020
Instalar moment en Laravel & vue
Instalando Moment
Paso 1 - Nuevo proyecto / Ejecutar proyect
laravel new test_fechas cd test_fechas php artisan serve
Paso 2: Instalar Vue (en otra ventana)
cd test_fechas composer require laravel/ui php artisan ui vuePaso 3 : Instalar moment
npm install npm install --save vue-moment npm run watch
Paso 3: Configurando moment
En archivo resources/js/app.js arriba de la seccion app agregamos.
/* moment */ import moment from 'moment' import 'moment/locale/es'; Vue.prototype.moment = moment Vue.use(require('vue-moment')); const app = new Vue({ el: '#app', });
Paso 4: Testing Moment
Abrimos el archivo resources/js/components/ExampleComponent.vue
<template> <div class="container"> <div class="row justify-content-center"> <div class="col-md-8"> <div class="card"> <div class="card-header">Example Component</div> <div class="card-body"> {{moment(fecha).format('dddd, Do MMMM YYYY, h:mm:ss a')}} </div> </div> </div> </div> </div> </template> <script> export default { mounted() { console.log('Component mounted.') }, data(){ return { fecha: new Date() } }, } </script>
Paso 5: Desplegando el Componente Para este ejemplo vamos a reemplazar la vista resources/views/welcome.blade.php con el siguiente contenido.
<!DOCTYPE html> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Laravel</title> <!-- Scripts --> <script src="{{ asset('js/app.js') }}" defer></script> </head> <body> <div id="app"> <example-component></example-component> </div> </body> </html>
Resultado final
martes, 10 de marzo de 2020
Cómo instalar OCI8 en Ubuntu 18.04 y PHP 7.2
Fuente: https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e
Instale Oracle Instant Client y SDK
Paso 1
Descargue Oracle Instant Client y SDK del sitio web de Oracle. (Necesita iniciar sesión en la página de Oracle)
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.htmlDescargar
Paso 2
Cree una nueva carpeta para almacenar archivos zip de Oracle Instant Client en su servidor.
sudo mkdir /usr/lib/oracle sudo mkdir /usr/lib/oracle/12.2 sudo mkdir /usr/lib/oracle/12.2/client64
Paso 3
Ahora necesitamos extraer los archivos.
sudo cp instantclient-basic-linux.x64-12.2.0.1.0.zip /usr/lib/oracle/12.2/client64 sudo cp instantclient-sdk-linux.x64-12.2.0.1.0.zip /usr/lib/oracle/12.2/client64 sudo cp instantclient-sqlplus-linux.x64-12.2.0.1.0.zip /usr/lib/oracle/12.2/client64 cd /usr/lib/oracle/12.2/client64 sudo unzip instantclient-basic-linux.x64-12.2.0.1.0.zip sudo unzip instantclient-sdk-linux.x64-12.2.0.1.0.zip sudo unzip instantclient-sqlplus-linux.x64-12.2.0.1.0.zip sudo mv instantclient_12_2 lib
Paso 4
A continuación, necesitamos crear un enlace simbólico a los archivos de Instant Client.
cd /usr/lib/oracle/12.2/client64/lib/ sudo ln -s libclntsh.so.12.1 libclntsh.so sudo ln -s libocci.so.12.1 libocci.so
Otra opcion para este mismo paso
ln -s /usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1 /usr/lib/oracle/12.2/client64/lib/libclntsh.so ln -s /usr/lib/oracle/12.2/client64/lib/libocci.so.12.1 /usr/lib/oracle/12.2/client64/lib/libocci.so
Paso 5
Agregue la carpeta a nuestro ldconfig.sudo su - echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle.conf
Paso 6
Actualice los enlaces de tiempo de ejecución de Dynamic Linker
ldconfig
Hecho. Ahora podemos pasar a la siguiente parte.
Instalar paquetes adicionales
Para instalar la extensión OCI8, necesitamos instalar algún paquete adicional en nuestro servidor.
Paso 1
Ejecute estos comandos:
sudo apt-get install php-dev php-pear build-essential libaio1
Paso 2
Una vez instalado, necesitamos obtener el archivo OCI8. Pero, antes de eso, necesitamos actualizar el canal PECL.
sudo pecl channel-update pecl.php.net
Luego instalaremos oci8
sudo pecl install oci8
Cuando se le solicite la ubicación del Instant Client, ingrese lo siguiente:
instantclient,/usr/lib/oracle/12.2/client64/lib
Al finalizar deberia mostrar:
Build process completed successfully Installing '/usr/lib/php/20170718/oci8.so' install ok: channel://pecl.php.net/oci8-2.2.0 configuration option "php_ini" is not set to php.ini location You should add "extension=oci8.so" to php.ini
Paso 3
Necesitamos decirle a PHP que cargue la extensión OCI8.
sudo su - sudo echo "extension=oci8.so" >> /etc/php/7.2/fpm/php.ini echo "extension=oci8.so" >> /etc/php/7.2/cli/php.ini
Paso 4
Actualiza el servidor.
sudo shutdown -r now
sudo service php7.2-fpm restart
Hasta aqui funciona el cli pero no fpm
Configurar fpm
Paso 1
cd /etc/php/7.2/mods-available/ sudo touch oci.ini sudo vi oci.iniagregaar a oci.ini
extension = oci8.so
Paso 2
Ahora cree un enlace simbólico como este:
cd /etc/php/7.2/fpm/conf.d sudo ln -s /etc/php/7.2/mods-available/oci.ini 20-oci.ini
Paso 3
Actualiza el servidor.
sudo shutdown -r now
sudo service php7.2-fpm restart
Paso 4
Ahora crea un archivo php info
cd /var/www/html/ sudo touch info.php sudo vi info.php
agregar a info.php
<?php phpinfo();
Deberia mostrar la seccion oci
oci8 OCI8 Support enabled OCI8 DTrace Support disabled OCI8 Version 2.2.0 Oracle Run-time Client Library Version 12.2.0.1.0 Oracle Compile-time Instant Client Version 12.2
Configurar Sqlplus (opcional)
Paso 1
Agregando rutas al .bashrc
cd $h vi .bashrc
Agregar
export ORACLE_HOME=/usr/lib/oracle/12.1/client64 export TNS_ADMIN=/usr/lib/oracle/12.1/client64/network/admin export PATH=$PATH:$ORACLE_HOME/lib export LD_LIBRARY_PATH=$ORACLE_HOME/lib export EDITOR=vi
Paso 2
Crear el archivo tnsnames.ora
cd /usr/lib/oracle/12.2/client64 sudo mkdir /usr/lib/oracle/12.2/client64/network sudo mkdir /usr/lib/oracle/12.2/client64/network/admin cd /usr/lib/oracle/12.2/client64/network/admin sudo touch tnsnames.ora sudo vi tnsnames.ora
Agregar
orcl = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = orcl) ) )
Por ultimo vamos a probar
sqlplus system/system@orcl