# The Trouble of Testing PHP Locally

In principle, deploying PHP is extremely easy. Just log into the FTP account of the hoster, upload your files, done. Before I deploy, I want to create a test environment locally such that I can quickly see what my changes actually do before uploading it.

I don't want to have a HTTP server and PHP running on my machine all the time. I also do not want to adjust any settings on my local machine for developing, so I thought creating a virtual machine with HTTP, PHP, and MariaDB for testing my PHP application. It turned out to be much more complicated:

1. Notice that the VirtualBox kernel module is not installed any more.
2. Install libvirt packages to use KVM/Qemu for virtualization.
3. Download new VM image with 600 kB/s because I did not have it for KVM yet.
4. Get error message because Fedora does not call the ethernet eth0 any more. Look on the web and try three different ways to get it working eventually.
5. Uncomment port forwarding in the Vagrantfile.
6. Have Ansible crash because python is missing, install that.
7. Have Ansible crash because python-dnf is missing, install that as well.
8. Create a small Ansible playbook and figure out the hosts: all setting.
9. Attempt to set up a shared directory between the project and /var/www/html via NFS. Enter root password for the host at least fifteen times. Does not work. Add snippets to sudoers file in order to not enter the password that often. NFS cannot be mounted. Find hint on the internet to let NFS through the firewall. Does not work either. Give up and use rsync instead.
10. CakePHP complains that certain directories are not writeable. Create them. Now it complains about other directories, create them as well. Repeat for a couple other directories.
16. Realize that mod_rewrite seems to be disabled. Add a task to the playbook.
17. Have Ansible crash because there is no a2enmod on Fedora.
18. See that mod_rewrite is already loaded. Then it must the that .htaccess files are not taken into account. Go into the httpd.conf and add AllowOverride All to the configuration. Then there is CSS and also the controller actions work.