Skip to content

brijeshdhaker/creativelights.in

Repository files navigation

PHP Installation

# apache setup
sudo apt install -y apache2

# enable site
sudo a2ensite creativelights.in
sudo systemctl restart apache2.service

# disable site
sudo a2dissite creativelights.in
sudo systemctl restart apache2.service

# install php
sudo apt install -y libapache2-mod-php php php-cli php-common php-cgi php-mysql php-json php-mbstring php-xml php-pcov php-ssh2 php-xdebug 

Setup directories /var/www/creativelights.in

sudo mkdir -p /var/www/creativelights.in
sudo chown -R $USER:$USER /var/www/creativelights.in
sudo chmod -R 755 /var/www/creativelights.in

sudo mkdir -p /var/log/creativelights.in
sudo chown -R $USER:$USER /var/log/creativelights.in
sudo chmod -R 777 /var/log/creativelights.in
sudo touch /var/log/creativelights.in/creativelights-2025-07-21.log
sudo touch /var/log/creativelights.in/creativelights-default.log
sudo touch /var/log/creativelights.in/neecreativelightstastudio-err.log

Install Composer

sudo apt -y install composer

# Install required packages
composer outdated --minor-only
composer update

#
composer require slim/slim:"4.*"
composer require slim/psr7
composer require nyholm/psr7 nyholm/psr7-server
composer require guzzlehttp/psr7 "^2"
composer require laminas/laminas-diactoros
#
composer require apache/log4php "2.3.0"
#
composer require phpmailer/phpmailer "~6.0"
#
composer require phpfastcache/phpfastcache
#
composer require phpoffice/phpspreadsheet
#
composer require php-di/php-di
#
composer require --dev phpunit/phpunit "^10.0"
composer require --dev vitexsoftware/phpunit-skeleton-generator --with-all-dependencies

Setup Virtualhost

sudo vi /etc/apache2/sites-available/creativelights.in.conf

<VirtualHost *:80>
        #
        ServerAdmin [email protected]
        ServerName creativelights.in
        ServerAlias www.creativelights.in
        DocumentRoot /var/www/creativelights.in
        
        #
        SetEnv APP_ENV "DEV"
        SetEnv APP_NAME "creativelights.in"
        SetEnv DB_HOST "mysqlserver.sandbox.net"
        SetEnv DB_USER "creativelights"
        SetEnv DB_NAME "CREATIVELIGHTS"
        SetEnv DB_PASSWORD_FILE_PATH "/run/secrets/mysql-root-password"

        #
        <Directory /var/www/creativelights.in>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>
        
        #
        ErrorLog ${APACHE_LOG_DIR}/creativelights_error.log
        CustomLog ${APACHE_LOG_DIR}/creativelights_access.log combined

</VirtualHost>

Restart Apache Server

sudo a2ensite creativelights.in.conf
sudo systemctl reload apache2

#
sudo a2enmod rewrite
sudo a2enmod actions

#
sudo systemctl start apache2
sudo systemctl stop apache2

#
sudo systemctl restart apache2
sudo systemctl status apache2

sudo systemctl enable apache2
sudo systemctl disable apache2

/var/www/creativelights.in/controllers/.htaccess

RewriteEngine On
RewriteBase /controllers
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

/var/www/creativelights.in/.htaccess (Optional)

RewriteEngine on
RewriteRule ^$ creativelights.in/ [L]
RewriteRule (.*) creativelights.in/$1 [L]

setup php-debugger

sudo apt -y install php-xdebug

PHPUnit Test Setup

docker-php-ext-install php-json pdo pdo_mysql

PHPUnit Setup ; /etc/php/8.3/apache2/php.ini /etc/php/8.3/cli/php.ini

[PHPUnit]
error_reporting=-1
zend.assertions=1
assert.exception=1
memory_limit=-1
;extension=mbstring

[xdebug-3.0]
xdebug.mode=develop,debug,coverage,profile,trace
;xdebug.client_host=docker.sandbox.net
;xdebug.client_port=9000
;xdebug.idekey=vscode
xdebug.start_with_request=yes
;xdebug.start_with_request=trigger
;xdebug.trigger_value=vscode

http://creativelights.in/index.php?_dc=fdfs&page=home&sTgt=site&XDEBUG_TRIGGER=vscode

dbgpProxy

./dbgpProxy -i 127.0.0.1:9001 -s 127.0.0.1:9000 

./dbgpProxy -f

Run PhpUnit Test

vendor/bin/phpunit "--bootstrap" "./bootstrap.php" "--filter" "%\btestgetRepositoryPath\b%" "./src/test/php/OnclickEnvTest.php"

/usr/bin/php -d xdebug.mode="develop,debug,coverage" "./vendor/bin/phpunit" "--colors" "--log-junit" "/tmp/nb-phpunit-log.xml" "--bootstrap" "./bootstrap.php" "--filter" "%\btestgetRepositoryPath\b%" "./src/test/php/OnclickEnvTest.php"

/usr/bin/php -d xdebug.mode=develop,debug,coverage "./conf/phpunit-12.3.11.phar" "--colors" "--log-junit" "/tmp/nb-phpunit-log.xml" "--bootstrap" "./bootstrap.php" "--configuration" "./phpunit.xml" "--filter" "%\btestGetMapping\b%" "./src/test/php/dao/MappingHelperTest.php"

ENV APACHE_DOCUMENT_ROOT /var/www/creativelights.in
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

http://creativelights.in/phpinfo.php

http://creativelights.in

Rest End Points

http://creativelights.in/controllers/hello/brijesh
http://creativelights.in/controllers/contactus
http://creativelights.in/controllers/subcribe-services
http://creativelights.in/controllers/collaboration
http://creativelights.in/controllers/book-session

Run App Using Docker

docker run -d -p 80:80 \
    -v /apps/var/logs/creativelights.in:/var/log/creativelights.in:rw \
    -v ${PWD}:/var/www/html \
    -v ${PWD}/conf/apache/apache2.conf:/etc/apache2/apache2.conf \
    -v ${PWD}/conf/apache/envvars:/etc/apache2/envvars \
    -v ${PWD}/conf/mysql/password.txt:/run/secrets/mysql-root-password:ro \
    -v ${PWD}/conf/php/php.ini:/usr/local/etc/php/php.ini \
    -w /var/www/html \
    --env-file ${PWD}/envvars \
    --add-host docker.sandbox.net:172.18.0.1 \
    --name creativelights.in \
    brijeshdhaker/php:8.4.13


docker exec -it creativelights.in /bin/bash

docker run --rm -it \
-e 'XDEBUG_TRIGGER=vscode' \
-v ${PWD}:/var/www/html \
-v ${PWD}/conf/mysql/password.txt:/run/secrets/mysql-root-password:ro \
-v ${PWD}/conf/php/php.ini:/usr/local/etc/php/php.ini \
-w /var/www/html \
--env-file ${PWD}/envvars \
--add-host docker.sandbox.net:172.18.0.1 \
--name phpunit-test \
brijeshdhaker/php:8.4.13 /bin/bash ${php} ${phpargs} ${phpunit} ${phpunitargs}

About

creativelights.in

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors