We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

webisite working on localhost but not on virtual machine

Hi, i have developed a website on my localhost. Its configuration files and directory structure resembles https://github.com/phalcon/invo/tree/0.5.0 I am quite new to working on remote servers so I uploaded the whole folder in the root folder of a vm server. The vm is usinig apache2. The only thing i have changed is the mysql database configration in config.ini file located in app/config.

Now the problem is whenever, i am trying to run the website, i see the directories and the files rather than website. When i click the public directory (where index file is located), i get the basic html format website (no bootstrap and js etc). Finally when i click any link on the index page, i get an error 404 i.e The requested URL /foo/bar/index was not found on this server.

Everything works fine when i am using local host, however, the same files doesn't work on the vm server. I would appreciate any form of help.

Thanks .



85.5k
edited Nov '16

Invo branches :

0.5.0 Updated 4 years ago
master Updated a month

I do hope you have followed the master branch :D

Anyways probably you messed the apache config



789

Master wasn't working properly on my pc for some reasons therefore, i choose 0.5.0. Apache2 has the default debian configuration on the vm server as well as on my localhost

Invo branches :

0.5.0 Updated 4 years ago
master Updated a month

I do hope you have followed the master branch :D

Anyways probably you messed the apache config

edited Nov '16

You are probabbly missing a lot more than just apache stuff. At first place, did you even installed Phalcon and PHP support for that VM of yours?

What is your 'localhost' machine? Windows? Phalcon version?

P.S. Using ages old version of some software is just terribly wrong.



789
edited Nov '16

Hi, i have installed everthing on the vm. The codes are working perfectly on another pc (windows) with the same installations.
Localhost is linux same as virtual machine. i have phalcon 3.0.1 installed in both devices. PHP version is0 5.6.27-0. Apache/2.4.10 (Debian),document root is "/var/www/html ". What do you suggest, should i make the config and loader files same as mater-invo or something else. I guess the problem is associated with the directory structure.

You are probabbly missing a lot more than just apache stuff. At first place, did you even installed Phalcon and PHP support for that VM of yours?

What is your 'localhost' machine? Windows? Phalcon version?

P.S. Using ages old version of some software is just terribly wrong.

You have not provided any crucial properties - what is your local setup?

If the software does work it doesn't mean it's secure and good, anything which God has gave up is dangerous.



789

sorry i updated my reply.

You have not provided any crucial properties - what is your local setup?

If the software does work it doesn't mean it's secure and good, anything which God has gave up is dangerous.

Base uri maybe other on local and vm ?



789

hi, i checked it before. It is same for both.

Base uri maybe other on local and vm ?

I mean how you access it on local machine, which exactly link and how on vm ? Maybe you need to change it for vm ? This is definitely either your server configuration or base uri is wrong, no other way.



789
edited Nov '16

yes i think you are right. The problem is related to the baseuri not server configuration.

My localhost root folder is in home/php/programing/www . My application folder suppose is 'foo' which is located in the root folder www. The configuration file in my local machine is ie

controllersDir = /../app/controllers/

modelsDir = /../app/models/

viewsDir = /../app/views/

pluginsDir = /../app/plugins/

libraryDir = /../app/library/

baseUri = /foo/

When i run the

<?php use Phalcon\Mvc\Url;

$url = new Url();

echo $url->getBaseUri();>?

output is "/public/ "on my local machine.

Now my virtual machine the root folder is the default apache folder i.e var/www/html, my application "foo" is inside html. The configurationfile for vm is same as above. The php codes mentioned above shows the same /public/ output. However, if i change the base uri to /foo/public/ then i see the index page as i designed, but the links give me error ie /foo/public/signup/index etc not found on server. any suggestion?

I mean how you access it on local machine, which exactly link and how on vm ? Maybe you need to change it for vm ? This is definitely either your server configuration or base uri is wrong, no other way.

Do you even know what is base uri ? Looks like not.

For example if you access page:

127.0.0.1/foo/somecontroller/someaction

Then base uri needs to be /foo/ and index.php needs to be under foo folder as well.

so just change base uri to correct one and check it again.



43.9k

Hi,

check if .htaccess files are here, if your vm websever has mod_rewrite enabled and if you have got the good rules in your vhost config file



789

i restrated it couple of time.

Perhaps you forgot to restart the web server after adding extensions and settings?



789

In the aforementhined link i've provided, the .htaccess file looks exactly the same. i will put it below for ur convience

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteRule ^$ public/     [L]

RewriteRule (.*) public/$1 [L]

</IfModule>

Hi,

check if .htaccess files are here, if your vm websever has mod_rewrite enabled and if you have got the good rules in your vhost config file



789

Kindly look at the config.ini file in the link provided. My base uri is of same type. And i am well aware of what base uri is Sir. Thanks.

Do you even know what is base uri ? Looks like not.

For example if you access page:

127.0.0.1/foo/somecontroller/someaction

Then base uri needs to be /foo/ and index.php needs to be under foo folder as well.

so just change base uri to correct one and check it again.



789

Okay, I am getting frustraded now. The problem still persits. Is there anyone trustworthy to whom i can email my files?



85.5k

add me at skype r1d3r_bg