Working with multiple PHP versions on MAC OS-X


Today I had to update a project that was developed using WordPress and PHP 5.3. Today I have PHP 5.4 installed on my machine and this newer version abandoned some old features, and you have some Fatal errors like Call-time pass-by-reference has been removed. The solution was go back to PHP 5.3 and do the updates on my the project, because the production server is with PHP 5.3 too.

The cleaner solution is using Vagrant, that allow you install only what you want for a specific project, leaving your machine cleaner. But was not my case at the moment.


I’ve used macports to install PHP in my machine. I think macports is a very good way to organize all sources in the same place. More information you can find here.

You can install PHP 5.3 and 5.4 in the same machine and decide what you’ll use just updating your Apache httpd.conf file.

Continue reading Working with multiple PHP versions on MAC OS-X

Secure file upload using chmod 755


Today I will talk about secure file upload.

Please, do not use chmod 777 on yours upload files. That means everyone can write on your directory and maybe execute that file.

Use chmod 755 and be happy. For that you must have to change the directory’s owner to the apache users. In the Ubuntu Linux the apache user is usually www-data, but using another versions can be apache, httpd, nobody or just www.


chown -R www-data upload_dir  
chown -R 755 upload_dir

See you…