Fatal error: Class 'Page' not found error

Silverstripe Version: 3.1.7

Hi,
We are trying to run an existing Silverstripe application on NGINX server. We are using SilverStripe version 3.1.7. We updated the database configurations to point to new database. On hitting the application domain url, we are getting the Silverstripe basic homepage instead of application homepage.
If we give the url http://domain.dev/mysite/ , we encounter Class ‘Page’ not found error.
If we try to access the admin http://domain.dev/admin, the URL gets redirected to admin/pages and gives the Class ‘Page’ not found error for framework/security/Security.php file.

Our Page.php is placed in mysite/code folder.

Any pointers on this will be of great help.

Thanks

I don’t know if NGINX hosting has an effect on this, but it sounds like the class manifest needs to be rebuilt. Did you do a dev/build on the domain? If not, try visiting http://domain.dev/dev/build

Hi JonoM,

I did try http://domain.dev/dev/build.
Also, I tried http://domain.dev/dev/build/?flush=1.
But none of these helped.

Anything else that I might be missing out on?

Thanks

Did the dev/build complete successfully or also throw an error?

Hi Daniel,

On doing the dev/build, the browser shows processing and redirects to
http:// domain.dev/Security/login?BackURL=%2Fdev%2Fbuild and then gives the Class ‘Page’ not found error.
There was no specific error related to dev/build.

Thanks

In this case it is kind of a chicken-egg problem;

If you have access to your server cpanel/ftp, you can try setting _config.php (changing _config/mysite.yml might not work since settings there require flush to refresh?) from “live” to “dev”, that way you can do the dev/build?flush without need of login
in your _config.php:

Director::set_environment_type("dev");

Hi,

I updated my _config.php file to set the environment to “dev”. Post this, the dev/build ran, I was able to see the DB tables getting listed. However, at the bottom, the Class ‘Page’ not found error is still there.

Am I missing out on any configuration to refer the framework files in my custom code? Are there any configurations to be done specific to this?

Thanks

Hi All,

I tried rebuilding the application by hitting http://domain.dev/dev/build?username=XXX&password=XXX and the build seems to be successful. However, the initial error on http://domain.dev/mysite/ is still giving the Class “Page” not found error.

Anything else that I can try?

Can you verify that the file mysite/code/Page.php contains something meaningful?

Perhaps it got wiped;
Another thing I can think of, would be to restart the server if you have access to shell.

I remember encountering a client on nginx with an issue of php code changes not being reflected; it was likely due to cache and required service php-fpm restart