FROM DEVELOPMENT TO PRODUCTION AN EVIL PLAN IN WORDPRESS giorgio.beggiora@artigianidelweb.com
THESE SLIDES before lunch didn t exist
WORDPRESS Generic requirements: PHP MySQL or MariaDB Apache
XAMPP www.apachefriends.org
INSTALL XAMPP Download portable version Unzip in root (example: D:\xampp) Run setup_xampp.bat every time you move it Launch with xampp-control.exe Note: by default, Skype uses the 80 and 443 ports creating a conflict with Apache, so you have to disable this Skype feature: Tools > Options > Advanced > Connection
BROWSER Dal proprio computer: http://localhost http://127.0.0.1 http://192.168.0.14 (esempio) http://miosito.it (se il file host è configurato) Da altri dispositivi nella stessa rete: http://192.168.0.14 (esempio) http://miosito.it (se il file host è configurato) Per conoscere il proprio IP su Windows, dal prompt dei comandi scrivere: ipconfig
VIRTUAL HOST D:\xampp\apache\conf\extra\httpd-vhosts.conf ## This code is for one site, but you can have multiple sites, ## just copy, paste and change values <VirtualHost *:80> DocumentRoot "D:/xampp/htdocs" ServerName miosito.it ## windows 403 fix <Directory /> AllowOverride none Require all granted </Directory> </VirtualHost>
FILE HOST Windows Aprire il blocco note come amministratore Inserire la password di amministratore e fare click su "Consenti" Aprire il file hosts (non ha estensione) localizzato in C:\Windows\System32\drivers\etc\ Aggiungere una riga con indirizzo IP e domini corrispondenti e poi salvare. 127.0.0.1 miosito.it www.miosito.it Altri sistemi https://support.serverplan.com/guide/61/0/come-visualizzare-il-sito-prima-delpuntamento-dns
LOCALE 4EVER? Valutate di sviluppare in produzione se: il vostro computer vi chiede un Gatorade state scrivendo codice PHP custom usate plugin vecchi o con funzioni particolari il server è vecchio o ha una configurazione particolare
SVILUPPARE IN PRODUZIONE?? #eresia Volevo dire: nel server di produzione. Per evitare che il sito sia visibile da chiunque possono essere usati alcuni accorgimenti, come: DNS + file host (consigliato) https://support.serverplan.com/guide/61/0/come-visualizzare-i l-sito-prima-del-puntamento-dns HTTP authentication WP plugin Maintenance (o simile) https://it.wordpress.org/plugins/maintenance/
INSTALL WP 1/2 Empty the D:\xampp\htdocs\ folder Download and extract wp in D:\xampp\htdocs\ so the wp-config.php file s path will be D:\xampp\htdocs\wp-config.php Create a database from http://localhost/phpmyadmin
INSTALL WP 2/2 Visit http://localhost/ Follow the white rabbit wizard Default database username: root Default database password: none (leave empty!) Done!
NOTA SUL PATH/ Consiglio di installare wordpress in un sottodominio piuttosto che in una sottocartella, sia per evitare problemi con i link che per evitare di mischiare le password salvate.
INSTALL WP BITNAMI Only 1 wordpress per XAMPP Wordpress will be installed in a wordpress folder and in a bitnami_wordpress database. Run Apache and MySQL services. Download the installer from https://bitnami.com/stack/xampp Run it. Indicate the XAMPP folder. The application password is the default wordpress administrator s password (username: user ). You don t need Wordpress in the cloud. Launch Bitnami Wordpress module. Finish!
MOVE WP TO PRODUCTION 1/2 Export (aka backup in a file, or create a dump of ) your development database using PHPMyAdmin (may be painful for large databases, but usually it s not) Import the dump file in an online database using production preinstalled PHPMyAdmin. If you don t have access to it, upload it by yourself in a wpcontent subfolder, but check the server requirements before, and remember to delete it after) Copy all the files via FTP
MOVE WP TO PRODUCTION 2/2 If the development url is different from the production url: Open wp-config.php file and edit the database credentials (and, if present, the site url) Using PHPMyAdmin, find the wp_options table and change the option_value of the records with siteurl and home as their option_name (DO NOT put a slash after the URL) If you get broken links or images in posts content, try to run this query from PHPMyAdmin: UPDATE wp_posts SET guid = REPLACE(guid, "localhost", "www.miosito.it"); In htaccess, find/replace localhost with www.miosito.it From wp admin, save permalinks Disable access restrictions to publish
...OR TRY DUPLICATOR https://it.wordpress.org/plugins/duplicator/ Great! But: result not guarantee (i.e. big websites, particular server configurations) needs (temporary) about the double of the disk space, and you find the available space only in the hosting settings.
THANK YOU TWITTER: @giorgiobeggiora GITHUB: giorgiobeggiora EMAIL: giorgio.beggiora@artigianidelweb.com