You can run your "LAMP" server on Windows with all benefits of Linux command line.
Download Cygwin and run setup. Choose this packages:
Web/httpd
Libs/libapr1-devel
Libs/libaprutil1-devel
PHP/httpd-mod_php7
PHP/php
Database/mysql
Database/mysql-server
PHP/php-fileinfo
PHP/php-mysqli
PHP/php-pdo_mysql
PHP/php-gd
PHP/php-Archive_Tar
PHP/php-bz2
PHP/php-zlib
PHP/php-json
PHP/php-ctype
PHP/php-exif
PHP/php-iconv
PHP/php-mbstring
PHP/php-curl
PHP/php-simplexml
PHP/php-xmlreader
PHP/php-xmlrpc
PHP/php-xmlwriter
PHP/php-zip
PHP/php-bcmath
Mail/exim
Mail/mutt
Editors/vim
Net/ncftp
Net/curl
Web/wget
Net/whois
...or you can run setup from command line with selected packages:
setup-x86_64.exe -P httpd -P libapr1-devel -P libaprutil1-devel -P httpd-mod_php7 -P php -P mysql -P mysql-server -P php-fileinfo -P php-mysqli -P php-pdo_mysql -P php-gd -P php-Archive_Tar -P php-bz2 -P php-zlib -P php-json -P php-ctype -P php-exif -P php-iconv -P php-mbstring -P php-curl -P php-simplexml -P php-xmlreader -P php-xmlrpc -P php-xmlwriter -P php-zip -P php-bcmath -P exim -P mutt -P vim -P ncftp -P curl -P wget -P whois
#42 Mutex posixsem (add)
#177 LoadModule rewrite_module modules/mod_rewrite.so (uncomment)
#212 ServerAdmin yourname@localhost (edit)
#222 ServerName localhost (add)
#245 DocumentRoot DocumentRoot "/cygdrive/c/www/" (edit)
#246 <Directory "/cygdrive/c/www/"> (edit)
#266 AllowOverride All (edit)
(All/None/AllowOverrideFileInfo/AuthConfig/Limit)
#297 ErrorLog "/cygdrive/c/www/error_log"
#326 CustomLog "/cygdrive/c/www/access_log" common
- #42 is line number in file, it is approximate value only for your orientation where you put or edit configurations
- This is configuration for
C:\www\
server root folder
#586 error_log = "/cygdrive/c/www/php_error_log" (add)
Run Apache server:
$ /usr/sbin/httpd -k start (restart/stop)
Run MySQL(MariaDB):
$ mysql_install_db (installation)
$ mysqld_safe & (run daemon)
$ mysqladmin -u root shutdown (shutdowm)
$ mysql_secure_installation (installation with setups)
Close Cygwin and run it again as admin, then rum Exim config:
$ exim-config
Who is the local postmaser? [yourname]
Primary host: localhost
IPV6: no
Sendmail: yes
Daemon: no
$ mailq (show queue)
$ rm -fvr /var/spool/exim (clear queue)
Forward all outcoming e-mails from server to yourname@localhost, about #527 line after "begin routers":
catch_all_outgoing:
driver = redirect
data = yourname@localhost
Creates /home/yourname/Mail
at first start
When error configuration, you can run: mutt -n (runs Mutt without configuration)
Next file in this gist is server.sh
. You can use it for running your server. Run Cygwin and type bash server.sh ?
for help.
Start Apache + MySQL server:
bash server.sh start
Restart only Apache server:
bash server.sh restart
Stop both server and kill all related proceses
bash server.sh kill
Show PHP error log fie
bash server.sh log php_err
For running PHP scripts from Windows command line or editors or IDEs add C:\[cygwin64 folder]\bin\
to system PATH variables.