-
Notifications
You must be signed in to change notification settings - Fork 0
PHP environment installation
HOME / Workstation prerequisites / PHP environment installation
Setup your LAMP development environment.
We'll build Apache from source.
echo 'Installing Apache Web Server...' && \
sudo -i && \
apt-get -y purge apache* && apt-get autoremove -y && rm /var/www/html -rf && \
cd ~/Downloads && \
wget http://tux.rainside.sk/apache//httpd/httpd-2.4.9.tar.gz -O httpd.tar.gz && tar xvf httpd.tar.gz && rm httpd.tar.gz && mv httpd-* httpd && \
wget http://tux.rainside.sk/apache//apr/apr-1.5.1.tar.gz -O apr.tar.gz && tar xvf apr.tar.gz && rm apr.tar.gz && mv apr-* apr && \
wget http://tux.rainside.sk/apache//apr/apr-util-1.5.3.tar.gz -O apr-util.tar.gz && tar xvf apr-util.tar.gz && rm apr-util.tar.gz && \
mv apr-util-* apr-util && mv apr httpd/srclib && mv apr-util httpd/srclib && \
cd httpd && ./configure --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc/apache2 \
--with-perl --with-ssl --enable-ssl --enable-rewrite --enable-suexec --enable-info --enable-socache-shmbc --disable-autoindex && \
make && make install && \
echo 'Installing upstart daemon...' && \
echo 'start on runlevel [2345]
stop on runlevel [!2345]
expect daemon
script
exec /usr/sbin/apachectl start
end script
pre-stop script
exec /usr/sbin/apachectl stop
end script
' > /etc/init/apache2.conf && initctl reload-configuration && \
mkdir -p /var/www/public && chown www-data:www-data /var/www -R && \
apachectl start
NOTE: You should change the version to download the latest Apache.
echo 'Configuring Web Server...' && \
apachectl stop && chsh -s /bin/bash www-data \
mkdir -p /etc/apache2/conf.d && mkdir -p /etc/apache2/common && mkdir -p /var/log/apache2 && \
rm /usr/local/apache2/cgi-bin/* && \
echo "Include /etc/apache2/mods-enabled.conf" >> /etc/apache2/httpd.conf && \
echo "Include /etc/apache2/webino.conf" >> /etc/apache2/httpd.conf && \
echo 'Installing enabled modules config...' && \
echo 'LoadModule deflate_module modules/mod_deflate.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule suexec_module modules/mod_suexec.so
' > /etc/apache2/mods-enabled.conf && \
echo 'Installing vendor config...' && \
echo '# Webino, s. r. o.
Include /etc/apache2/conf.d/
IncludeOptional /srv/*/vhost.conf
' > /etc/apache2/webino.conf && \
echo 'Configure web server...' && \
echo '# Apache settings
User www-data
Group www-data
AddType text/x-component .htc
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
' > /etc/apache2/conf.d/custom.conf && \
apachectl start
We'll build PHP from source.
sudo -i && \
apt-get install -y libgvc6 libcurl4-openssl-dev pkg-config libpspell-dev libicu-dev libmagickwand-dev libmcrypt-dev libxslt-dev && \
cd ~/Downloads && \
wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz -O imap-2007f.tar.gz && tar xvf imap-2007f.tar.gz && rm imap-2007f.tar.gz && \
cd imap-2007f && make slx SSLINCLUDE=/usr/include/openssl EXTRACFLAGS=-fPIC && \
mkdir lib && mkdir include && \
cp c-client/*.c lib/ && cp c-client/*.h include/ && cp c-client/c-client.a lib/libc-client.a && cp . /usr/local/imap-2007f -R && \
cd /root/downloads && \
wget http://cz1.php.net/get/php-5.5.13.tar.gz/from/this/mirror -O php.tar.gz && tar xvf php.tar.gz && rm php.tar.gz && mv php-5.5.13 php && \
cd php && ./configure --with-config-file-path=/etc/php5 --with-config-file-scan-dir=/etc/php5/conf.d --with-apxs2=/usr/bin/apxs --enable-cli --with-mysql --with-pdo-mysql \
--with-mysqli --with-pear --with-openssl --with-iconv --with-xsl=usr --with-curl --enable-mbstring --enable-exif --with-zlib --with-zlib-dir --with-gd --with-jpeg-dir=/usr/lib \
--with-gettext --enable-gd-native-ttf --with-freetype-dir --with-mhash --enable-ftp --with-pspell --with-mcrypt --enable-calendar --enable-pcntl --enable-soap --enable-sockets \
--enable-wddx --enable-zip --with-imap=/usr/local/imap-2007f --with-kerberos --with-imap-ssl --enable-bcmath && \
make && make install && \
mkdir -p /etc/php5 && mkdir -p /etc/php5/conf.d && \
cp ./php.ini-production /etc/php5/php.ini && \
pear config-set php_ini /etc/php5/php.ini && pecl config-set php_ini /etc/php5/php.ini && \
echo '
max_execution_time = 1000
max_input_time = 1000
memory_limit = 512M
error_log = /var/log/php5_error.log
post_max_size = 500M
upload_max_filesize = 500M
date.timezone = Europe/Bratislava
pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
mysql.default_socket = /var/run/mysqld/mysqld.sock
mysqli.default_socket = /var/run/mysqld/mysqld.sock
session.save_path = /tmp
' > /etc/php5/conf.d/custom.ini && \
printf "\n" | pecl install imagick intl memcache && \
echo '<IfModule mod_php5.c>
DirectoryIndex index.php
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
</IfModule>
' > /etc/apache2/conf.d/php5.conf && \
echo 'Setting php-cli.ini...' && \
echo 'extension=intl.so
extension=imagick.so
' > /etc/php5/php-cli.ini && \
apachectl restart
NOTE: You should change the version to download the latest PHP 5.5.
sudo pecl install channel://pecl.php.net/xhprof-0.9.4 && \
sudo pecl install xdebug
NOTE: You should change the version to download the latest Xhprof.
sudo -i && \
mkdir -p /var/www/public/tools && \
echo '<?php
phpinfo();
' > /var/www/public/tools/info.php && \
chown www-data:www-data /var/www/public/tools -R && \
sed -i 's~</VirtualHost>~\
# Development Environment Config\
DocumentRoot /var/www/public\
<Directory /var/www/public>\
AllowOverride all
Require all granted\
Order Deny,Allow\
Deny from all\
Allow from localhost\
</Directory>\
</VirtualHost>~' /etc/apache2/conf.d/custom.conf && \
echo '; Development environment configuration
expose_php = On
display_errors = On
display_startup_errors = On
error_reporting = E_ALL
track_errors = On
phar.readonly = Off
xdebug.max_nesting_level = 200
' > /etc/php5/conf.d/dev.ini && \
apachectl restart
sudo -i && \
echo "MySQL root password: " && \
read rootpwd && \
echo "MySQL client password: " && \
read clientpwd && \
apt-get install -y mysql-server mysql-client && \
echo "[client]
user = root
password = $rootpwd
" > /root/.my.cnf && \
echo "[client]
user = dbclient
password = $clientpwd
" > /var/www/.my.cnf && chown www-data:www-data /var/www/.my.cnf && \
mysql -e "CREATE USER 'dbclient'@'localhost' IDENTIFIED BY '$clientpwd'; \
GRANT CREATE ROUTINE, CREATE TEMPORARY TABLES, LOCK TABLES, ALTER, CREATE, CREATE VIEW, DELETE, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, \
UPDATE, ALTER ROUTINE, EXECUTE, SUPER ON *.* TO 'dbclient'@'localhost';"
Post-configuration and installation of a database admin tool.
echo 'Installing DB admin utility...' && \
sudo su - www-data -c "cd /var/www/public/tools && \
wget http://downloads.sourceforge.net/adminer/adminer-4.1.0-mysql-en.php -O adminer.php"
NOTE: You should change the version to download the latest Adminer.
We want to ensure a quality software products, testing is a must do.
It helps us to generate unit-test classes automatically.
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit_SkeletonGenerator
Web browser automation for integration testing.
echo 'Installing Selenium...' && \
sudo mkdir /opt/selenium && \
sudo wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar -O /opt/selenium/selenium-server.jar && \
sudo wget https://gist.githubusercontent.com/bacinsky/0008e490ac1e035b51cc/raw/328f6c9ee945d1ca5b46b745e4577be605064057/selenium -O /etc/init.d/selenium && \
sudo chmod +x /etc/init.d/selenium
NOTE: You should change the version to download the latest Selenium Server.
Some tools to ensure professional coding style.
sudo pear config-set auto_discover 1 && \
sudo pear install PHP_CodeSniffer && \
sudo pear channel-discover pear.phpmd.org && \
sudo pear install phpmd/PHP_PMD-1.5.0 && \
sudo wget http://get.sensiolabs.org/php-cs-fixer.phar -O /usr/local/bin/php-cs-fixer && \
sudo chmod a+x /usr/local/bin/php-cs-fixer
NOTE: You should change the version to download the latest tool.
If something is wrong with this wiki, please let us know.
Webino™ is a webapp's platform. © 2014 by Webino, s. r. o. All rights reserved.
Prerequisites
How to install
- [Operating system](Operating system installation)
- [Development tools](Development tools installation)
- [PHP environment](PHP environment installation)
- [Webino devkit](How to install webino devkit)
How to develop
- [Use webino devkit](How to use webino devkit)
- [Modules development](How to develop webino modules)