If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Yii2 project on hosting

Started by Rakesh01, Jan 12, 2023, 09:33 AM

Previous topic - Next topic

Rakesh01Topic starter

The project built on Yii2 Basic requires proper uploading to the hosting.
There are two folders involved in the process - web folder on the test domain and docs folder on the public hosting. The former contains public files and "looks" to the test domain while the latter is predefined for the domain.
 

What is the recommended approach to uploading such a project onto the hosting server?
  •  


GavinOwlsen

To properly upload the project, the contents of the web folder should be transferred to the docs folder while ensuring that all dependencies and configurations are accurately reflected. If possible, any other files or folders should be placed next to or above this level of hierarchy.

Another crucial aspect to consider is whether the hosting supports all necessary PHP modules, such as mbstring, etc. It's essential to confirm that the hosting supports all required modules before proceeding with deployment.
  •  

meganiams

It's important to secure all "giblets" (sensitive files) by adding appropriate protections in the .htaccess file to prevent unauthorized external access.

Additionally, for optimal security and configuration, it's recommended to change the root folder (dоcumentRoot) of the Apache/nginx server. This can typically be done through the admin panel provided by the hosting service. If the option is not immediately visible, contacting the administrators may be helpful in finding a solution.
  •  

Atcomaart

Theoretically, implementing a PHP script to download remote repositories, analyze changes, and update files would not be overly challenging. The script could run through the project, inspecting any updates, and then refresh local files accordingly. However, there may be different variations of this process that could be implemented.

Regarding tunneling, similar scripts may exist for this type of functionality, though it's unclear how to create or find one. While it's uncertain if composer can run in this way, it's possible that a web version could be produced to perform similar tasks such as yii migrate. It's likely that similar scripts or processes have already been created and may serve as a useful resource for development purposes.
  •  

Weerabocuourijo

The recommended approach to uploading a project onto the hosting server involves several key steps to ensure a smooth and successful deployment. Here's a detailed guide on how to accomplish this task:

1. Pre-Deployment Checklist:
  - Confirm that the project's codebase is stable, tested, and ready for production deployment.
  - Verify that all necessary dependencies and components required for the project are included in the codebase.

2. Web Hosting Configuration:
  - Access the hosting control panel or use FTP to connect to the server.
  - Create a new directory for the project if one does not already exist. Note the server's web root directory path, as this is where the "web" folder of the project will be uploaded.

3. Compile and Minify Assets:
  - Utilize Yii2's asset management tools to compile and compress assets (CSS, JavaScript, images) to optimize performance and reduce load times.

4. Uploading the Project Files:
  - Utilize an FTP client or the hosting control panel's file manager to transfer the entire contents of the "web" folder from the local development environment to the web root directory on the hosting server.
  - Ensure proper permissions are set to allow the web server to access the files. Commonly, directories should have 755 permissions and files 644 permissions.

5. Configure Domain Settings:
  - If a domain is associated with the hosting, configure the domain settings to point to the web root directory where the Yii2 project is located. Update the domain's dоcument root to the "web" folder for the project.

6. Upload the "Docs" Folder:
  - If the "docs" folder contains publicly accessible content such as dоcumentation or media files, use the file manager or FTP to upload this folder to the appropriate location on the server. Ensure that any necessary access restrictions or permissions are set as per the project requirements.

7. Update Configuration Settings:
  - Review and update any configuration files within the Yii2 project to reflect the production environment settings. This may include updating database connection settings, base URLs, and other environment-specific configurations.

8. Testing and Troubleshooting:
  - After the project has been uploaded, perform comprehensive testing to ensure proper functionality.
  - Test for any issues related to file paths, server configurations, or database connectivity.
  - Address any errors or issues that arise during testing, and ensure that the project behaves as expected in the hosting environment.

By diligently following these steps, you can ensure a meticulous and careful approach to uploading the Yii2 Basic project onto the hosting server. This detailed process helps to minimize potential errors and ensures a smooth transition to the production environment, promoting optimal performance and reliability of the web application.
  •  

aAgilifypl

Follow these steps to deploy your Yii2 Basic project onto your hosting server:

Version Control: First, ensure you have a proper version control system like Git in place. It helps track changes, facilitates collaboration, and simplifies deployment.

Composer Dump: Use Composer to manage your project's dependencies. Dump the autoload files using composer dump-autoload to ensure all required libraries are in place.

Upload via SFTP: Utilize SFTP (SSH File Transfer Protocol) to securely upload your project files to the web folder on your test domain. SFTP ensures data integrity and security during the transfer.

Database Migration: Create a new database and user on your hosting server. Update your Yii2 application's database configuration accordingly. Use Yii2's migration tool to set up your database schema.

Update .htaccess and web.config: Ensure your .htaccess and web.config files are properly configured to handle URL rewriting and routing, as Yii2 requires.

Test Locally: Before uploading, test your application locally to ensure everything works as expected. This step can save you from potential headaches during the deployment process.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...