简体   繁体   中英

Transfer web app in php (codeigniter) from localhost to my server and domain

I was working on a project with my client. I mostly do frontend work so I don't really understand what is wrong here.

We got a white label license of a prebuilt app that we worked over and redesigned completely on our local host (i use MAMP on mac). The app is working perfectly fine there and has no problems.

When I tried to transfer my app to my host server It wont load. it doesn't show a not found and such error when Like if I place a file there and purposely link it to the wrong page, the page is just blank

the hosting server and stuff works, if I place a random index.html file in the same folder it will show up.

My process was, copy over all the database stuff (MySQL) from one PHPmyadmin to the other.

I created a new database and user with full access for that.

Use the file manager and upload the zipped file and extract it on my server.

now the codeigniter part has the part of the code where it needs to link to, i needed to edit it the first time, it wouldn't work on my localhost otherwise.

The code goes like this.

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| If this is not set then CodeIgniter will try guess the protocol, domain
| and path to your installation. However, you should always configure this
| explicitly and never rely on auto-guessing, especially in production
| environments.
|
*/
public $baseURL = 'http://localhost:8888/hr-prw';

I also have a databse.php and it has these lines of code.

/**
 * The directory that holds the Migrations
 * and Seeds directories.
 *
 * @var string
 */
public $filesPath = APPPATH . 'Database/';

/**
 * Lets you choose which connection group to
 * use if no other is specified.
 *
 * @var string
 */
public $defaultGroup = 'default';

/**
 * The default database connection.
 *
 * @var array
 */
public $default = [
    'DSN'      => 'mysql:host=localhost;dbname=root',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => 'root',
    'database' => 'root',
    'DBDriver' => 'MySQLi',
    'DBPrefix' => '',
    'pConnect' => true,
    'DBDebug'  => (ENVIRONMENT !== 'production'),
    'cacheOn'  => false,
    'cacheDir' => '',
    'charset'  => 'utf8',
    'DBCollat' => 'utf8_general_ci',
    'swapPre'  => '',
    'encrypt'  => false,
    'compress' => false,
    'strictOn' => false,
    'failover' => [],
    'port'     => 3306,
];

Now this is all of the stuff that runs locally on my MAMP and it works perfectly fine.

For the host I created a subdomain. Let's say my file location and the database info looks like this.

testnet.domain.hr/hr.prw

databse info: username: database_root password: databaseroot database name: database_root

Now I would love to know where do I need to put what to get this work cause when i type in.

https://testnet.domain.com/hr-prw/

it show a blank page with error 500 when I go to inspect network.

I tried to put the info in those two tables and edit in various different combinations but I had no luck, thank you a lot for your help.. If you need any more info just ask.

Found the issue, INTL wasnt enabled on my host PHP version, that fixed everything.

Change public $baseURL = 'http://localhost:8888/hr-prw' value to your own domain or project root location like so

public $baseURL = 'http://example.com/hr-prw';

you can binding from server with nginx or apache and then set from http://localhost:8888/hr-prw

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM