Skip to content

Instantly share code, notes, and snippets.

@ankibalyan
Last active August 29, 2015 14:26
Show Gist options
  • Save ankibalyan/736b64699e171b0b63df to your computer and use it in GitHub Desktop.
Save ankibalyan/736b64699e171b0b63df to your computer and use it in GitHub Desktop.
Set Up PHP Development Evnviroment
Host Machine: Linux Ubuntu
Download From
http://releases.ubuntu.com/14.04.3/ubuntu-14.04.3-desktop-amd64.iso
editor/IDE: Sublime
Download From
http://c758482.r82.cf2.rackcdn.com/sublime-text_build-3083_amd64.deb
Database tool: mysql-workbench
sudo apt-get install mysql-workbench
Virtual Box - Vagrant
sudo apt-get install virtualbox
sudo apt-get install vagrant
Vagrant Box: Linux Ubuntu
web Server: nginx
php version: 5.6
database: mysql-server
Install Linux, nginx, MySQL, PHP (LEMP) stack
nginx
sudo apt-get update
sudo apt-get install nginx
sudo apt-get update
check localhost or server ip address
"welcome message by nginx"
To stop your web server, you can type:
sudo service nginx stop
To start the web server when it is stopped, type:
sudo service nginx start
To stop and then start the service again, type:
sudo service nginx restart
Install MySQL to Manage Site Data
sudo apt-get install mysql-server
sudo mysql_install_db
sudo mysql_secure_installation
Install PHP for Processing
sudo apt-get install php5-fpm php5-mysql
configure php.ini
sudo nano /etc/php5/fpm/php.ini
cgi.fix_pathinfo=0
sudo service php5-fpm restart
Configure Nginx to Use our PHP Processor
sudo nano /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name server_domain_name_or_IP;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
save it.
sudo service nginx restart
test it by putting a php file
#Few common Extentions
To install curl
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
To Install mcrypt extenstion
sudo apt-get install php5-mcrypt
To Install Gd extention
sudo apt-get install php5-gd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment