YII framework, is SSH required to run protected/yiic.php migrate - php

We have a company doing several websites for us using the YII framework. The developers tell us that in order to run protected/yiic.php migrate that they must have SSH access to our server.
We are reluctant to provide SSH as there are many clients on our server. Is SSH really required as they say or can this migration script run via other means via the web browser?

You can write php-script, that will execute migrates, use CConsoleCommand for base, but it is not simple issue.

The fastest way run the migration only SSH, but approach proposed by Alex also nice.

Related

Bundling Electron JS with laravel and sqlite

I developed a desktop application in react and electronjs. And built an API with laravel, eveything works perfectly. The challenge I have is, how I can deploy and run my electron app locally without having to manually setup the laravel API.
I am looking for a way to have all of this setup and installed once. I checked out a couple of options and one of such is php-server but that wasn't still going to cut it.
Shell Scripting
I have thought about executing a shell script to create the server instance pull my laravel application from github, set it all up on docker.
The challenge is, if any of my users run docker ps they would see all the processes running on my docker instance.
A possible solution would be isolating docker so it's not accessible globally but only within the application.
I don't know how to achieve this.
If this is achievable please drop some guide on how to achieve that or maybe suggest a better way to handle my current situation.

How run migrate commands by controller?

I want create an installation controller for my web app and for config db need run migration commands from controller.
For example when user visit
localhost/backend/webapp/index.php?install/step1
by action step1 run migrate up and down command and do installation.
Thanks from #soju and #meysam you can use both solutions.
Use exec:
Perhaps combining stackoverflow.com/a/35864018/1592247 and exec
function of php could helps (#meysam)
Use extensions:
How can I call a console command in web application in Yii 2.0 (#soju)
Both way may help you.
be aware using exec may cause some security issues and disable in some servers.

Laravel - how to serve a new laravel project to browser

This is the first time I've used a PHP framework.
I've been following the Laravel documentation to install Composer and Laravel, and everything seems to have gone smoothly.
But now I've finished the installation/configure instructions, and I have created a project, I can't see any instructions on how to serve my application so it's viewable via a browser?
I have used Ruby on Rails before, which came with an easy way to get an instance of the application running via a built-in web server.
Is there something similar with Laravel, or do I need to somehow configure my standard Apache instance to serve the application?
I'm guessing there is something I've overlooked or misunderstood in the documentation.
yes, you can do it by using following in your terminal.
open your terminal, and navigate to directory where you have your project abc
and fire following command
php artisan serve
Now you can access it in browser by going to http://localhost:8000
hope you get it
I just want to add to the answer of Mubin Khalid . You can choose your own port number like
php artisan serve --port=8080
This is helpful when running two or more project.
You can also serve with you ip address
php artisan serve --host=ip_of_computer_running_laravel --port=8080
works to access server with in same network.
if you are accessing from same laptop you can just browse to ip_of_computer_running_laravel:8080 but if you are browsing from other computer in the network ip_of_computer_running_laravel:8080

From schema to SQL

I just started out with CakePHP and try to configure a plugin.
The plugin requires a table and contains a schema.php file that contains a class describing the table. From what I gather I have to run a command in my server CLI that will build a table according to this schema.
But my server doesn't seem to have CLI (it's cPanel, and my website is hosted by a good but cheap host). I tried to access the server using Putty, but the connection is aborted when I try.
However, I do have phpMyAdmin where I can run SQL commands. So if I can 'convert' my schema.php in the appropiate SQL commands, I can copy these manually and run them. Is there an easy way to do this?
(I know, the fasted solution is probably to just enter the table by hand. but that would be boring)
Thank you!!
Scipio

Using Apache ANT to deploy web applications?

I was just able to get Apache ANT running on my computer. The ant -version commando outputs the version number , verifying that the installation went well.
I have read that ANT is well suited to handle deployment of web applications including PHP projects and have spent some time to get it working, but I just can't get my head around how to set it up to sync my files to my web server.
How can I make ANT sync folderA with folderB ?
Thanks
Last time I checked (long ago) there was no remote sync task in Ant (only local). You would have to write a shell script that calls rsync and execute this from Ant instead. There is a number of remote tasks though. And you could check out your code from your VCS instead of syncing it to the server.
On a sidenote, you might want to consider Phing over Ant. It's a port of Ant to PHP. It has a FileSync Task. You can also add your own Tasks (written in PHP) and is commonly used in Continuous Integration servers for PHP.
Also see What is your preferred Deployment Strategy for PHP and a couple others.
Read the manual: http://ant.apache.org/manual/index.html
Look at the <copy> task.
I was looking to do the same and just came across this article on how to deploy using ant, maybe it'll give you a different way of going about it: Deploying using Ant

Categories