For future reference…
PHP
- Download an x64 Thread Safe zip from php.net.
- Read the note about Visual C++ Redistributable in the sidebar of that download page, and install the one required for your version.
- Unzip somewhere and add to PATH.
- Pick a php.ini and adjust as necessary (enabled extensions, etc.).
- In particular, make sure the following is not commented out:
- Check that it works:
Composer
- Download the Windows Installer from getcomposer.org.
- Run the installer..
- Check that it works:
Apache
- Download the Apache Win64 zip from apachelounge.com.
- Read the note about Visual C++ Redistributable above the downloads on that download page, and install the required one.
- Unzip somewhere and adjust httpd.conf as necessary (paths, enabled modules, etc.).
- Install as service:
- Start the service.
- Check that it works:
Apache with PHP
- Add the following to httpd.conf.
LoadModule php7_module C:/path/to/php/php7apache2_4.dll
<IfModule php7_module>
DirectoryIndex index.html index.php
AddHandler application/x-httpd-php .php
PHPIniDir "C:/path/to/php"
</IfModule>
- Add an index.php to your DocumentRoot for testing, e.g.:
- Restart the Apache service.
- Check that it works:
MariaDB
- Download a Windows x86_64 MSI Package via mariadb.org.
- Run the installer.
- Optionally add some of the following to my.ini under mysqld section:
; Only listen on localhost
bind-address=127.0.0.1
; Enable logging of queries
; (probably bad in production, but very helpful for development debugging)
general-log=1
general-log-file=queries.log
log-output=file
- Restart the service, if you changed anything in the ini.
- Check that it works by connecting with HeidiSQL or any other SQL client.
Just a note for next time I need to mess with date/time format strings for PHP strftime calls, Apache log format configuration, etc…
🎈ðŸ‘🎉strftime.net
I’m using a simple PHP cross-domain-proxy to be able to do some Javascript requests towards an API on a different domain. Worked great, until I needed to do basic authentication. I set the appropriate header to be passed through, 'Authorization': 'Basic ' + btoa(username+':'+password)
, but in the proxy script, that header had vanished.
Turns out it was Apache stripping it away. Don’t know if it’s because of security or because Apache thinks that, hey, I’m the one dealing with this stuff so no point sending it to the script. Anyways, seems you can get it back by doing the following in an .htaccess file:
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
Now the header is passed through to the API successfully and I’m no longer getting 401 Unauthorized back 🙂
The following .htaccess
redirects all traffic to a different domain and preserves the path.
RewriteEngine On
RewriteRule (.*) http://example.com/$1 [R=301,L]
The following redirects non-www to www version, also preserving the path.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
And hopefully I’ll remember I put this here the next time I’ve forgotten how to do this…
Usually when I develop websites, they will be deployed to a domain, for example www.geekality.net. But when I develop this site locally, I usually want it to be in some sub-folder of localhost, since I usually have more than one website going on, and I don’t want the trouble with virtual-hosts. So, to solve this for my Kohana websites I do the following simple thing. This technique would work for other websites programmed in PHP as well, but the PHP part would probably be a bit different.
Continue reading PHP: One way of differing between DEV and PROD environments with Kohana →
Needed to get a LAMP environment up and running for some Kohana development. Starting with a more or less fresh install of Ubuntu, here’s what I did.
Continue reading Quick installation of LAMP for Kohana on Ubuntu →
Was writing a blog post today. Happy, typing away. Hit Preview, and *bam*:
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Continue reading This blog post can make WordPress crash →
With a hint of Social Ineptitude