Cheap Web Space, Domain Name:
Web Space With E-Mail, PHP/MySQL.

How can I run PHP scripts on the Linux command line, e.g. Nextcloud "occ"?

Question: 

Searching …

 

Unfortunately nothing found on "".

Premium support for Bitpalace web hosting customers only!

 in the United States (Chicago, IL): 1 (815) 526-7037, Fax (in Germany) +49 30 32 70 18 91

service@bitpalace.com 

Skype: bitpalast

One moment please … your browser is loading the page.

 

 

Symptom

Some applications were not developed by the developers for shared hosting, although they can basically be used there.

One such application is Nextcloud. The developers assume that you can not only call the application in the browser, but also control it from the Linux command line with the help of maintenance scripts. Nextcloud contains e.g. a command line tool "occ" with which some maintenance tasks can be carried out. Sometimes you need "occ" to repair the Nextcloud database or to maintain indexes after a failed update.

In other cases and with other applications, too, it can be helpful to be able to execute PHP scripts on the Linux command line. Above all, users want to be able to freely choose the PHP version with which a script is executed. However, because in a shared hosting environment only one system serves all customer accounts on the same machine with the same software, this is not possible here.

 

Solution

In order to be able to execute a PHP script on the Linux command line with your desired PHP version, you take a little detour: You create an inactive “scheduled task”. This has several advantages. Not only are you free to choose the PHP version, but the web space control center also ensures that no access permissions are violated.

This is how it works (the example uses Nextcloud "occ", but the solution also applies to all other PHP scripts in your web space):

1. Log into the webspace control panel.

2. Click the “Websites & Domains” menu.

3. Click on "Scheduled Tasks" in the right column.

4. Click the "Add Task" button.

5. Remove the check mark from the "Active" selection box.

6. For the task type, select: "Run a PHP script".

7. Enter the path and name of your PHP script under "Script path". The path begins in your FTP root directory. For example, if you have a Nextcloud installation in httpdocs, you would enter "occ" to run the script:

httpdocs/occ

8. To the right of the script path, you can enter the parameters that are to be transferred to the script. For example, if you want to have a Nextcloud database repaired, you would enter

maintenance:repair

9. Select your preferred PHP version from the “Use PHP version” dropdown box. For the Nextcloud "occ" script, this must be exactly the PHP version that your Nextcloud installation uses. In "Websites & Domains" you can use the PHP icon to check which PHP version is set for your website.

How can I run PHP scripts on the Linux command line, e.g. Nextcloud "occ"? - Illustration no. 1

10. Click the "Run Now" button.

The script will run exactly as if you run it from the Linux command line, in the example above

/usr/bin/php ./httpdocs/occ maintenance:repair

The webspace control panel enters the path to the appropriate PHP version in the command for you. It also monitors the safe execution of the script and shows you feedback on the execution of the task.

Since you have set the "scheduled task" to "inactive", it will not be executed automatically at a certain time, but only when you click "Run Now". For frequently recurring tasks, you can save the PHP command lines and run them later with a click of the mouse.

 

Overview of frequently asked questions 

 

 

 


 

Additional Services

Starter Server: Affordable web server from  3.73 US$ () /month with PHP, database and many more 

Online Reservation System: Occupancy & vacancy schedule for any ressources (vehicles, sports facilities …) & guest houses, holiday apartments …  8.91 US$ () /month 

Software development: Development of database applications, programming and revision of computer programs & scripts  44.08 US$ () /hour 

 

FAQ – frequently asked questions 

 

Kiribati

Austria

Cameroon

Guinea

Pakistan

Colombia

Cuba

Antigua and Barbuda

Panama

Papua New Guinea

Jordan

Argentina

Costa Rica

Australia

Germany

Bahamas

Lesotho

Barbados

Belize

Paraguay

Tuvalu

Honduras

Peru

Madagascar

Bolivia

Botswana

Malawi

Chile

Philippines

India

Malta

Puerto Rico

Rwanda

Saint Kitts and Nevis

Samoa

Marshall Islands

Saint Vincent and the Grenadines

Zambia

Jamaica

Mauritius

Saint Lucia

Dominican Republic

Liberia

Switzerland

Mexico

Canada

Dominican Republic

Micronesia, Federated States of

Seychelles

Namibia

Ecuador

Sierra Leone

El Salvador

Fiji

Singapore

Gambia

Solomon Islands

Nauru

Spain

New Zealand

Sudan

Swaziland

Nicaragua

Nigeria

South Africa

Kenya

Ghana

Tanzania, United Republic of

Tonga

Guyana

Trinidad and Tobago

Uganda

Palau

Uruguay

Venezuela

Ireland

Grenada

Guatemala

United Kingdom

Zimbabwe

 

"Cheap Web Space": Affordable web space, cheap web server, low-cost webserver, low-price web servers: fast web server / small web server (cheap web space). Web server for private homepages / small website projects.

 in the United States (Chicago, IL): 1 (815) 526-7037 •  GmbH, Sensburger Allee 27, D-14055 Berlin (Germany)
Your purchase is tax-free, because you order from a non-EU country. © 2024  GmbH. All rights reserved. and the logo are registered trademarks of GmbH. For photo credits see imprint.

Imprint Privacy policy Sitemap