Do the following online:
- Create github.com account (if not already)
- From github.com fork this repo: https://github.com/phpcl/phpcl_core_php8_developers into your own github account
- Go to your github.com account page
- Locate the forked repo
- Click on the
Codebutton and copy the clone URL, referred to as%%FORK%%in this guide
Do the following online:
- Go to the
ip2c.orgwebsite and write down your public-facing IP address - Login to your LfPHP Cloud Services account
- Click on
Accountand then choose on one of your Hosting Plans and click onDetailsfor that plan - Write down the account (immediately under Status and just above Website) which we refer to as
%%ACCOUNT%%in this guide - From the left side navigation menu click on
Access Tokens - Enter the IP address noted in step 1 and click
Add - Write down (or copy) the access token generated (which we refer to as
%%TOKEN%%) in this guide - Write down (or copy) the username you used to login into your LfPHP account, which we refer to as
%%USER%%in this guide
- Install PHP 7.1 or above (if not already installed)
- Clone
%%FORK%%into a directory/path/to/repoon your local computer
git clone %%FORK%% /path/to/repo/%%FORK%%
- Install Linux for Composer
cd /path/to/repo/%%FORK%%
php composer.phar self-update
php composer.phar install
These two files need to be created in order to deploy to the cloud:
Dockerfilelinuxforcomposer.jsonYou can create these files either manually or automatically.
Use the Linux for Composer Tools to create the two config files as follows:
- Copy the
/path/to/repo/templates/creds.json.dist:
cd /path/to/repo
cp templates/creds.json.dist ./creds.json`
- Modify
/path/to/repo/creds.jsonas follows: | Replace ... | With ... | | :---------- | :------- | | %FORK%% | ... the URL value represented by%%FORK%%which you wrote down in an earlier step above | | %%GITHUB_EMAIL%% | ... your github.com email address | | %%GITHUB_NAME%% | ... your github.com account name | | %%ACCOUNT%% | ... your Linux for PHP Cloud Services account name (all lowercase) | | %%USER%% | ... your Linux for PHP Cloud Services login name (email address) | | %%TOKEN%% | ... your Linux for PHP Cloud Services access token | - Run the Linux for Composer Tools command to generate the two config files:
- Commands if you're running on Linux:
cd /path/to/repo
./lfc.sh creds creds.json templates/ --suffix=dist --no-prompt
- Commands if you're running on Windows:
cd \path\to\repo
lfc.bat creds creds.json templates\ --suffix=dist --no-prompt
Manual creation involves copying and modifying the *.dist files to /path/to/repo.
Copy the file linuxforcomposer.json.dist to linuxforcomposer.json
In the newly copied linuxforcomposer.json file:
- Locate the
lfphp-cloudkey - Replace the values of the following subkeys with the values you wrote down in the preceding steps:
/* other keys not shown */
"lfphp-cloud" : {
"account" : "%%ACCOUNT%%",
"username" : "%%USER%%",
"token" : "%%TOKEN%%"
}
}
Be sure to save the file when done!
Copy Dockerfile.dist to Dockerfile
In the newly copied Dockerfile you need to change the github source to your own:
- Change URL
"%%FORK%%"to the URL value represented by%%FORK%%which you wrote down in an earlier step above. - Change
%%GITHUB_EMAIL%%your github.com email address - Change
%%GITHUB_NAME%%to your github.com account name Don't forget to save the file when done!
If you want to test locally before deployment, proceed as follows:
- Install Docker
- Windows: https://docs.docker.com/docker-for-windows/install/
- Mac: https://docs.docker.com/docker-for-mac/install/
- Linux:
- Ubuntu/Debian: https://docs.docker.com/engine/install/ubuntu/
- Fedora/CentOS/RedHat: https://docs.docker.com/engine/install/fedora/
- Use Linux for Composer to start the container locally:
- From a Linux command prompt:
cd /path/to/repo/%%FORK%%
./lfc.sh start
- From a Windows command prompt:
cd \path\to\repo\%%FORK%%
lfc.bat start
- Find the container ID (which we refer to as
%%CONTAINER_ID%%in this guide):
docker container ls
- Find the IP address assigned (which we refer to as
%%CONTAINER_IP_ADDR%%in this guide):
docker exec -it %%CONTAINER_ID%% /bin/bash -c "ifconfig"
- Test from your browser using this URL:
http://%%CONTAINER_IP_ADDR%%/
- Alternatively:
http://localhost:8888/
You are now ready to deploy to your LfPHP Cloud Services account. Proceed as follows:
- Use Linux for Composer to deploy:
- From a Linux command prompt:
cd /path/to/repo/%%FORK%%
./lfc.sh deploy
* From a Windows command prompt:
cd \path\to\repo\%%FORK%%
lfc.bat deploy
- Return to your LfPHP Cloud Services account plan Dashboard
- Wait until the Status button goes green. WARNING: this could take around a few minutes to complete because PHP 8 needs to be compiled!!!
- Click on the link Website View
Sample database:
- Database Name:
phpcl - Database User:
phpcl - Database Password:
password - Otherwise you can also view the database through the LfPHP Cloud Services Dashboard. Refreshing source code:
- Edit or create the target file from your local repository
- Push the changes to github adding a comment
%%COMMENT%%
cd /path/to/repo/%%FORK%%
git add *
git commit -m '%%COMMENT%%'
git push
- From the main page of the website click on the link
Refresh - Database access: from the main page of the website click on the link
phpMyAdmin