-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Improved ./server and server.bat - Fixed document root in ./server - Removed unnecessary `trim()`
- Loading branch information
1 parent
ab54f01
commit f6973aa
Showing
7 changed files
with
91 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
# Setup PHP and PORT | ||
PHP_BIN="/usr/bin/php" | ||
PHP_INI="/etc/php5/cli/php.ini" | ||
PHP_BIN=/usr/bin/php | ||
PHP_INI=/etc/php.ini | ||
HOST_HOST=localhost | ||
HOST_PORT=9000 | ||
|
||
# Used to restore current dir if using command line | ||
BASEDIR=$(dirname "${0}") | ||
# Sets the project path so you can call the "./server" command from any location | ||
DOCUMENT_ROOT=$(cd -- $(dirname ${BASH_SOURCE:-$0}) && pwd -P) | ||
|
||
# Router path | ||
ROUTER="$BASEDIR/index.php" | ||
ROUTER=$DOCUMENT_ROOT/index.php | ||
|
||
# Start built in server | ||
$PHP_BIN -S "$HOST_HOST:$HOST_PORT" -c $PHP_INI -t "$BASEDIR" $ROUTER | ||
if [ ! -f "$PHP_BIN" ]; then | ||
echo ERROR: $PHP_BIN not found | ||
elif [ ! -f "$PHP_INI" ]; then | ||
echo ERROR: $PHP_INI not found | ||
else | ||
# Start built in server | ||
"$PHP_BIN" -S $HOST_HOST:$HOST_PORT -c "$PHP_INI" -t "$DOCUMENT_ROOT" "$ROUTER" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
@echo off | ||
|
||
:: Setup PHP and PORT | ||
set PHP_BIN="C:\php\php.exe" | ||
set PHP_INI="C:\php\php.ini" | ||
rem Setup PHP and PORT | ||
set PHP_BIN=C:\php\php.exe | ||
set PHP_INI=C:\php\php.ini | ||
set HOST_HOST=localhost | ||
set HOST_PORT=9000 | ||
|
||
:: Current path | ||
set CURRENT_PATH=%~dp0 | ||
set CURRENT_PATH=%CURRENT_PATH:~0,-1% | ||
rem Sets the project path so you can call the "server" command from any location | ||
set DOCUMENT_ROOT=%~dp0 | ||
set DOCUMENT_ROOT=%DOCUMENT_ROOT:~0,-1% | ||
|
||
:: Router path | ||
set ROUTER="%CURRENT_PATH%\index.php" | ||
rem Router path | ||
set ROUTER=%DOCUMENT_ROOT%\index.php | ||
|
||
if not exist %PHP_BIN% ( | ||
echo ERROR: %PHP_BIN% not found | ||
pause | ||
echo ERROR: %PHP_BIN% not found & pause | ||
) else if not exist %PHP_INI% ( | ||
echo ERROR: %PHP_INI% not found | ||
pause | ||
echo ERROR: %PHP_INI% not found & pause | ||
) else ( | ||
:: Start built in server | ||
%PHP_BIN% -S "%HOST_HOST%:%HOST_PORT%" -c %PHP_INI% -t "%CURRENT_PATH%" %ROUTER% || pause | ||
rem Start built in server | ||
"%PHP_BIN%" -S %HOST_HOST%:%HOST_PORT% -c "%PHP_INI%" -t "%DOCUMENT_ROOT%" "%ROUTER%" || pause | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters