- Download file from server into local folder
- scp username@ipserver:{Server Path} {Your local Path}
- example : scp root@123.231.233.333:/var/log/mysql/mariadb-slow.log /Users/ahmad/Downloads/
- scp username@ipserver:{Server Path} {Your local Path}
- Run php in background like (worker)
- php index.php worker process_generate_invoice
- Check IPV4 using mac terminal
- curl ipinfo.io/ip
Crud Ci 4
- Need to add migration for make CRUD
- Migration step using CLI
- Run command php spark make:migration

- After that need to enter class name migration

- Will generate file on app/database/migrations

- Then run
php spark migrate
- Run command php spark make:migration
- Migration step using CLI
- After migration proceed to generate controllers file
- Controller step using CLI
- Run command php spark make:controller
- In CRUD scenario we can use –restful

- In CRUD scenario we can use –restful
- After that need to enter class name controller

- Then controllers file will be generated with function default Restful function

- Run command php spark make:controller
- Controller step using CLI
- Then generate model
- Model step using CLI
- Run command php spark make:model

- After that need to enter class name model

- Then model will be generated like this

- Setup allowed fields

- Run command php spark make:model
- Model step using CLI
- Then we will start with listing using function index
- add code for query data using model

- add index.php in folder students

- add code for view listing in index.php

- then go to app/config/routes.php setup routes for listing

- add code for query data using model
- Next we go to create
- In function new load view for create

- In view file add form code

- Then add code at function create for insert data

- Setup routes like this

- In function new load view for create
- After create we continue with Update
- Add code at function edit with view file


- Then we add function update

- Setup routes

- Add code at function edit with view file
- Lastly, we make function delete
- Just add process for delete at function delete

- Setup routes

- Just add process for delete at function delete
- Settle !!!
Note: Goodluck on your CRUD using CI4
Set auto remove log file on server
- Set cron by system user
sudo crontab -u username -e - Then add script for delete all log file after 3 days
0 0 * * * find /home/smap/webapps/ppa-smap-my/application/logs -name "log-*.php" -type f -mtime +1 -delete
Setup Supervisor Worker
- Enabled service for supervisor
- in my situation i enable supervisor services on runcloud
- Then Login in terminal server
- Go to supervisor.d
cd /etc/supervisor.d - Then vim a file name u want to add
- in my situation i add ci-worker.conf
/etc/supervisor.d $ vim ci-worker.conf
- in my situation i add ci-worker.conf
- Then add this code into your file
[program:ci-worker]
command=php /home/example/webapps/app-example/index.php worker process_example_queue
autostart=true
autorestart=true
stderr_logfile=/var/log/ci-worker.err.log stdout_logfile=/var/log/ci-worker.out.log- for
/home/example/webapps/app-example/index.phpis your web application path - for
workeris your controller name - for
process_example_queueis your function in controller to be excute stderr_logfile&stdout_logfileis generated log for monitoring. U can specify path for log file to be generated
- for
- After finish add file for worker can run both script
sudo supervisorctl rereadsudo supervisorctl update
- Then u can run to restart worker process
sudo supervisorctl restart ci-worker
Notes
- For check all status for worker u can run
sudo supervisorctl status
- If u make changes in worker file changes not be effected immediately u need to restart your worker like step no 8.
Local changes overwrite merge

- Step to resolve error
- Discard changes affected in server
- can check all changes using
git status (in superuser do mode) - can discard all changes
git checkout . (in superuser do mode) - for discard a changes file
git restore <file> (in superuser do mode)
- can check all changes using
- Change ownership for file
- after discard changes ownership file will change to root
- can change ownership fill to old owner
chown <owner name>:<group name> <file name> (in superuser do mode)
- Discard changes affected in server
Update SMAP website
- Download static file wordpress
- Get file index.html from static file then replace index.php on application/views/web/index.php
- Get folder wp-includes from static file then replace wp-includes at repo
- Get folder wp-content from static file then replace wp-content at repo
How to login server without password
- On server side
- Add directory .ssh if dont have
- Add file authorized_keys in directory .ssh
- In file authorized_keys can put your ssh key
- On local side
- Set ~/.ssh
- If dont have file config in .ssh can add file config
- If have can add code
Host host-name //use for login
Hostname 123.233.443.422 //server Ip address
Preferredauthentications publickey
User system-user //system user
Note : please remove comment before paste code - After that u can login server using ssh host-name
- Set ~/.ssh
Step for daily backup on server
- add folder script dalam webapps
- add file daily-backup.sh dalam folder scripts
- chmod +x daily-backup.sh (change file mode to executable)
- (optional) to test script can run use sudo bash [file-name]
- add code at etc/cron.d
Change background in vsc
- Download extension background

- In vscode run Cmd/Ctrl + shift + p then choose open settings (JSON)
- Copy this code & paste into open settings (JSON)
{
"background.enabled": true,
"background.loop": false,
"background.useDefault": false,
"background.useFront": false,
"background.style": {
"content": "''",
"pointer-events": "none",
"position": "absolute",
"z-index": "99999",
"width": "100%",
"height": "100%",
"background-position": "center",
"background-size": "contain",
"background-repeat": "no-repeat",
"opacity": 0.1
},
"background.customImages": [
"https://img.indianautosblog.com/2018/10/20/honda-cbr250rr-tricolour-right-front-quarter-db72.jpg"
]
}
Pointing domain to server
- Point domain pergi ke server baru
- Copy ip address server baru
- Masuk Cpanel
- pergi zone editor
- manage
- add record
- masuk run cloud
- pergi web applications
- empty web app
- Change owner at tools
- Import source code
- Import database backup
- Set session in config/config.php
