Tag Archives

3 Articles
WordPress 4.9.1 dengan PHP 7.2

WordPress 4.9.1 dengan PHP 7.2

Saya biasanya kalau mau memperbaharui WordPress selalu menunggu versi minor .1 atau lebih. Soalnya, suka ada perilaku tak terduga kalau versi mayor baru terbit. Kali ini, WordPress 4.9.1 sudah terbit.

Menurut situsnya, WordPress merekomendasikan penggunaan PHP 7.2. Saya sendiri baru tahu kalau sudah ada PHP 7.2. Pantas saja WordPress berhenti di versi 4.8.4 pada beberapa peladen.

Saatnya memasang PHP 7.2!

Pemasangan PHP 7.2

Saya pernah membahas tentang PHP 7.1+ di artikel terdahulu. Jadi, ini sekedar mengulang saja.

Aktifkan modul APT untuk mengakses repo berbasis HTTPS dan beberapa paket lainnya.

sudo apt-get install apt-transport-https lsb-release ca-certificates

Aktifkan repo Suri.

wget -O- https://packages.sury.org/php/apt.gpg | sudo apt-key add -
echo "deb https://packages.sury.org/php/ jessie main" | sudo tee -a /etc/apt/sources.list.d/php-sury.list
sudo apt update

Lalu, pasang PHP 7.2 untuk menggantikan PHP 5.

sudo apt install php7.2-fpm php7.2-curl php7.2-gd php7.2-imagick php7.2-json php7.2-mysql php7.2-readline php-redis php7.2-xml php7.2-mbstring php7.2-zip php7.2-mysql

Kalau hanya sekedar php-fpm, yang terpasang bakal versi 7.1. Harus secara eksplisit disebutkan versi 7.2.

Selanjutnya, menyalin konfigurasi fpm dari /etc/php5/fpm/pool.d ke /etc/php/7.2/fpm/pool.d untuk setiap pool.

Saya sejauh ini tidak ada masalah.

Fungsi Yang Mulai Ditinggalkan

Nampaknya PHP7 dan terbaru hendak dibuat menjadi domain yang ketat (strict typecast). Mungkin pengembang PHP ingin menjadikan PHP sebagai bahasa yang lebih aman. Kalau saya melihat log, biasanya akan diprotes bentuk akses senarai (array). Saya mendapati fungsi count() terutama yang paling sering dicatat.

count(): Parameter must be an array or an object that implements Countable in ...

Ada orang-orang yang memutuskan untuk kembali ke PHP 7.1. Tapi saya tidak! Agar sesuai dengan PHP7.2 dan terbaru, misalnya ada variabel:

count($elements[‘#value’])

count ( $elements )

Diubah dengan menambahkan uji tipe senarai :

is_array ( $elements ) && count ( $elements )

Atau, saat diubah menjadi tipe senarai:

$elements = ( array ) $source->getElements();

Penyebab ini semua kalau saya lihat di kode sumber WordPress adalah biasanya karena penggunaan variabel global.

Untung saja, untuk yang lain pun WordPress dan plugin-nya sudah cukup bersahabat.

Bacaan Lebih Lanjut

Memasang Laravel dengan SQLite3

Memasang Laravel dengan SQLite3

Saya lupa untuk memasang contoh kalau sudah benar di artikel sebelum ini. Ya, sudah, kalau begitu kita coba saja Laravel dengan SQLite3 sebagai basisdatanya.

Buat Situs Baru

Jalankan perintah berikut:

laravel new situs-sqlite && cd situs-sqlite

Tergantung kecepatan koneksi Anda, Anda bisa mandi dulu. Sudah mandi, ‘kan?

Modifikasi Konfigurasi untuk SQLite3

Ubah berkas .env membuat semua variabel dengan awalan DB_ dan tambahkan variabel untuk SQLite.

sed -i "/DB/d"  .env
echo "DB_CONNECTION=sqlite" >> .env
echo "DB_DATABASE='storage/testdb.sqlite'" >> .env

Buat sebuah basis data baru.

touch storage/testdb.sqlite

Jalankan migrasi.

php artisan migrate

Jalankan peladen Laravel. Untuk kesenangan semata, saya menjalankan pada port yang berbeda.

php artisan serve --host 10.0.2.15 --port 8001

Ya, IP yang aneh itu adalah IP lokal VirtualBox. Saya menggunakan itu agar port-nya dapat diteruskan ke inang. Sehingga, saya bisa mengakses dari peramban saya sendiri.

Kalau benar tampilannya akan seperti berikut:

Laravel first-app.

Memasang Laravel pada Debian Jessie

Memasang Laravel pada Debian Jessie

Laravel bisa dengan PHP 5.6, tetapi lebih baik gunakan versi 7 saja. Versi 7 ada di DotDeb.

Persiapan

Pemasangan repo DotDeb dengan membuat /etc/apt/sources.list.d/dotdeb.list

echo "deb http://packages.dotdeb.org jessie all" | sudo tee -a /etc/apt/sources.list.d/dotdeb.list
echo "deb-src http://packages.dotdeb.org jessie all" | sudo tee -a /etc/apt/sources.list.d/dotdeb.list

Daftarkan kunci  repositori DotDeb dan kemudian perbaharui daftar paket.

wget -O- https://www.dotdeb.org/dotdeb.gpg  | sudo apt-key add
sudo apt update

Pasang Perkakas

Pasang hal-hal remeh.

sudo apt install unzip git

Pasang PHP7.

sudo apt install php-cli php-pgsql php-mysql php-sqlite3 php-mbstring php-xml php-zip

Pasang Composer.

sudo wget https://getcomposer.org/download/1.4.2/composer.phar -O /usr/local/bin/composer && sudo chmod +x /usr/local/bin/composer

Tambahkan PATH untuk Composer.

echo "PATH=\$PATH\:\$HOME/.composer/vendor/bin"  >> ~/.bashrc

Tak perlu keluar:

source ~/.bashrc

Pasang Laravel.

composer global require "laravel/installer"

Selesai.

 The twins looked at each other jubilantly but with some surprise. Although 70-534 answer analysis they 70-534 answer analysis considered themselves Scarlett’s favored suitors, they had never before gained tokens ADM-201 exam dumps of this favor so easily. Usually she made them beg and plead, while she put them off, CISSP exam topics refusing to give a 70-534 answer analysis Yes or No answer, laughing if they sulked, growing cool if they became angry. And here she had practically promised them 70-534 answer analysis the ADM-201 exam dumps whole of tomorrow—seats by her at 70-534 answer analysis the barbecue, all the waltzes (and they’d see to it that the dances were CISSP exam topics all waltzes!) and the supper intermission. This was worth getting expelled from the university.Filled ADM-201 exam dumps with new enthusiasm by their success, they CISSP exam topics lingered on, talking about the barbecue 70-534 answer analysis and the ball and Ashley Wilkes 300-208 study material CISSP exam topics and Melanie Hamilton, CISSP exam topics interrupting each other, making jokes and laughing at them, hinting broadly for invitations 300-208 study material to supper. ADM-201 exam dumps Some time had passed before they realized that Scarlett was having very little to say. The atmosphere had somehow changed. Just how, the twins did not know, but the fine glow had gone out of the afternoon. Scarlett seemed to ADM-201 exam dumps be paying little attention to 70-534 answer analysis what they 300-208 study material 70-534 answer analysis ADM-201 exam dumps said, although she made the correct answers. Sensing something they 300-208 study material could not understand, baffled and annoyed by it, the twins struggled along for a while, and then rose reluctantly, ADM-201 exam dumps looking at their 300-208 study material watches.The sun was low CISSP exam topics across the new-plowed fields and the tall woods across the river ADM-201 exam dumps were looming ADM-201 exam dumps blackly in silhouette. Chimney swallows were darting swiftly across the yard, and chickens, ducks and turkeys were waddling 70-534 answer analysis and strutting and straggling in from the fields.Stuart bellowed: “Jeems!” And after an interval a 70-534 answer analysis tall black boy of their own age ran breathlessly around CISSP exam topics the house and out toward the ADM-201 exam dumps tethered horses. Jeems was their 300-208 study material body servant and, like CISSP exam topics the dogs, accompanied them everywhere. He had been CISSP exam topics their childhood playmate and had been given to the twins for their own ADM-201 exam dumps on their tenth birthday. At the sight of him, CISSP exam topics CISSP exam topics the Tarleton hounds rose up out of the red dust and stood waiting expectantly for their masters. The 300-208 study material boys bowed, shook hands and 300-208 study material told CISSP exam topics Scarlett they’d be over 300-208 study material at the 300-208 study material Wilkeses’ early in the morning, waiting for her. Then CISSP exam topics they were ADM-201 exam dumps off down the 70-534 answer analysis walk CISSP exam topics at a rush, mounted their horses and, followed by ADM-201 exam dumps ADM-201 exam dumps Jeems, went down the avenue of cedars at a gallop, waving their hats and yelling back to her.When they had rounded the curve of the dusty road that hid them from Tara, Brent drew his horse to a ADM-201 exam dumps stop under a clump of dogwood. Stuart halted, 70-534 answer analysis too, and the darky boy pulled up a few paces behind 300-208 study material them. The horses, feeling slack reins, 300-208 study material stretched down their necks to crop the tender spring grass, and the patient hounds lay down again in the 300-208 study material CISSP exam topics soft red dust and looked up longingly at the chimney swallows circling in the gathering dusk. 300-208 study material Brent’s wide ingenuous face was puzzled and mildly indignant.“Look,” he said. “Don’t it look to you like she 70-534 answer analysis would of asked us to stay for supper?”  Nor did 70-534 answer analysis James and Andrew, who took him into their store in Savannah, regret his lack of education. His clear hand, his 300-208 study material accurate CISSP exam topics figures and his shrewd ADM-201 exam dumps ability in bargaining won their respect, where a knowledge 70-534 answer analysis of literature and a fine appreciation of music, had young 300-208 study material Gerald possessed them, would have moved them to snorts of contempt. America, in the early years of the century, had been kind to the Irish. James and Andrew, who had begun by hauling goods in covered wagons 70-534 answer analysis from Savannah to Georgia’s inland towns, had prospered into a store of their own, and Gerald prospered with them.