Laravel Homestead Vagrant windows setup

video notes:
9:35 editing hosts files
6:13 putty ssh to vagrant server

# start vagrant
# inside C:\Users\username\Desktop\vagrant\Code
$ vagrant up

# the url will be

# vagrant for public access
# :public_network, ip: ""

# to allow symbolic links, ln -s
# in windows 7 you need to run the terminal as administrator

xdebug setup

copy output of
$ php -i
<?php phpinfo(); ?>

paste into

Follow the instructions on that site after you submit

$ wget
$ tar -xvzf xdebug-2.2.4.tgz
$ cd xdebug-2.2.4
# install apt-get install php5-dev for phpize to work
$ phpize
$ ./configure
$ make
$ cp modules/ /usr/lib/php5/20090626+lfs

or one command setup
$ sudo pecl install xdebug

Edit /etc/php5/apache2/php.ini or /etc/php5/apache2/conf.d/xdebug.ini
Edit /etc/php5/cli/php.ini (for phpstorm interpreter)

zend_extension= [extension provided in]

for phpstorm interpreter to work you need to determine what is the “Loaded Configuration File” and paste the [xdebug] code in aswell (Loaded Configuration File => /etc/php5/cli/php.ini)
$ php -i | grep php.ini

restart webserver
if using port 9003 because I believe fastCGI is using 9000

PHPSTORM 7 setup
Firefox add-on:
The easiest Xdebug
JetBrains Firefox extension 0.6.0

File -> Settings -> PHP

File -> Settings -> PHP -> … (next to the interpreter input)
(debugger will only show if you edit the /cli/php.ini)

File -> Settings -> PHP -> Servers

File -> Settings -> PHP -> Servers -> Validate Remote Environment

File -> Settings -> PHP -> Debug

Run -> Edit Configurations

Create javascript debug

Make sure the listener is on

Run the javascript debugger then its going to ask to install the firefox add-on but it will only work after you restart your computer.

Also make sure you set a break point and that break point is at a point in page it can arrive because if an error the page will terminate without arriving at the break point.

Went to
Generated xdebug bookmarklets with idekey in the site as PHPSTORM
added to firefox bookmark ‘start debugger’
click on the bookmarklet ‘start debugger’ while in my ‘localhost’ site



Laravel blade not compiling or showing in browser.

I was having an issue that when I saved a file using winscp to laravel4 the view in the browser would not change. I figured out that laravel view blades caches to app/storage/view and the way it knows whether to recompile it is by the dates the view blade file was changed and the cache file was created. In winscp the cache file was off by an hour ahead.

The way I fixed this was by changing winscp login environment settings to “Preserve Remote Timestamp”

and also adjusting my server time to match the actual time on my other computer.

The server time has to be an earlier time than your computer

Also this was a fix to the issue with sublimetext sftp package sync funcitonality.


Optimizing PHP by minimize the request to the database

Optimizing PHP by minimize the request to the database by putting into a array

The array key is a hash and the value is the id. The reason you hash the key is because your looking up more than one field such as the first_name, last_name and company. Instead of putting this all together into a long string you can hash it into 8 characters and when your going to run the database check the array first to see if the query was already ran if not run the sql and append it to the array. It’s a cache.

	function get_user($first_name, $last_name, $company) {
		$hash = hash('crc32', $first_name . $last_name . $company);

		if (array_key_exists($hash, $this->users_cache)) {
			echo 'from cache';
			$ownerID = $this->users_cache[$hash] ;
			$ownerID = db_lookup("SELECT userID
				FROM `users`
				WHERE `last_name` = '" . trim($last_name) . "' 
				AND first_name = '" . trim($first_name) ."' 
				AND company LIKE '%". $company ."%'"

			$this->users_cache[$hash] = $ownerID;


		return $ownerID;

OwnCloud Server

ownCloud is a software suite that provides a location-independent storage area for data

Have php and webserver installed. (I’m using ubuntu 11.10)
$ sudo apt-get install apache2 php5 mysql-server php5-mysql phpmyadmin

Install ownCloud
$ sudo wget
$ sudo bunzip2 owncloud-4.5.7.tar.bz2
$ sudo tar -xvf owncloud-4.5.7.tar
$ sudo mv owncloud/ /var/www/
$ sudo chown -R www-data:www-data /var/www/owncloud/

Done. Now go to localhost/owncloud
Make ownCloud accessible outside your home network.

You may receive this error:
Your data directory and your files are probably accessible from the internet. The .htaccess file that ownCloud provides is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.

This mean that your .htaccess doesn’t have permission to override the php.ini
You don’t have to change anything to make owncloud work but if you want this feature read “Allow htaccess to override php.ini”

To increase amount of data that can be uploaded.
There’s two options you can edit upload_max_filesize and post_max_size in the /etc/php5/apache2/php.ini file or edit the .htaccess if you did the above configuration.

Allow htaccess to override php.ini

In order .htaccess to override the configuration on php.ini you must edit your apache configuration.

In order for the .htaccess code below to work in your site

<IfModule mod_php5.c>
php_value upload_max_filesize 10MB
php_value post_max_size 10MB

You’ll will need to insert the code below to /etc/apache2/sites-available/default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost


    <Directory /var/www/>
        AllowOverride All


Then restart apache
$ /etc/init.d/apache2 restart


ubuntu server add .htaccess directory
allow php.ini to be override using .htaccess
php.ini increase upload size
php ini httpd conf htaccess
.htaccess is not overriding php.ini
.htaccess override php.ini
changing php ini values using .htaccess
change php ini htaccess not working