I am trying to integrate Wordpress with Question2Answer so that they both use the same database for users. The instructions for doing this are pretty straight-forward. All I need to do is define the directory for my Wordpress installation in the Question2Answer config file. Unfortunately, no matter how I define the path to the Wordpress directory, I get a 500 error.
The urls for the installations are:
Wordpress: http://stage.example.com
Question2Answer: http://stage.example.com/ask
The directory structure is
Wordpress: public_html/stage
Question2Answer: public_html/stage/ask
Definition:
define('QA_WORDPRESS_INTEGRATE_PATH', '../');
I've tried 100 different ways to define the path to the Wordpress directory in my Question2Answer config file and I keep getting a 500 error. I'm fairly certain that I am defining the path to the directory correctly so I think it must be some sort of permissions or .htaccess problem but I'm not sure what it could be. Any ideas?
Here is the error:
PHP Question2Answer fatal error: Could not find wp-load.php file for WordPress integration - please check QA_WORDPRESS_INTEGRATE_PATH in qa-config.php
This might be silly, but keep in mind that the whole define('QA_WORDPRESS_INTEGRATE_PATH', '/PATH/WORDPRESS/'); is in a comment line. So you have to put the */ before the define line.
I was also struggling a lot, until I saw this post
Related
I've been working on this for several days now and I'm at the point of pulling my hair out.
Goal: to deploy Slim4 on my LAMP server within a specific subdirectory and accessible via a simple URL.
Structure:
There are several instances of my web app on the server and the setup should be replicated for all of them; the structure is straight forward:
/var/www/company1.com/app
this "app" folder contains the main index.php of the website, as well as other various folders. Eg. /var/www/company1.com/app/index.php => https://company.com/index.php
there is a folder called "api" within which I want to load Slim4. I don't really mind how this folder is structured and how deep it goes. I'm working on basis that this is where the composer file goes.
the end result should be that the customer can access the api by calling https://company1.com/api
I'm using the openapi-generator and the Pet Store yaml file.
Running:
openapi-generator-cli generate -i petstore.yaml -g php-slim4 -o /var/www/company1/api/
I've then run composer install and setup the config.inc.php file as described in the instructions.
However when I navigate to http://company1.com/api I am greeted with the same issue every time:
404 Not Found Type: Slim\Exception\HttpNotFoundException Code: 404 Message: Not found. File: /var/www/company1.com/app/api/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php Line: 91 Trace: #0 /var/www/company1.com/app/api/vendor/slim/slim/Slim/Middleware/RoutingMiddleware.php(58): Slim\Middleware\RoutingMiddleware->performRouting() #1 /var/www/company1.com/app/api/vendor/slim/slim/Slim/MiddlewareDispatcher.php(147): Slim\Middleware\RoutingMiddleware->process()
it goes on...!
I can't figure this problem out.
This issue seems to be quite common as there are a lot of posts about it, so I'm convinced I've missed something very simple.
I have tried the following:
Setting the base path
$app->setBasePath("/api");
Creating a /public/ folder and moving the index.php file there, then creating two different .htaccess files, based on these instructions:
https://akrabat.com/running-slim-4-in-a-subdirectory/
using basepath as per its instructions
https://github.com/selective-php/basepath
None of it seems to work! What am I doing wrong?
I have been able to successful load the Slim4 Skeleton application, however I want to use the openapi-generator so that I can have it automatically prepare all the php files based on my openapi yaml spec.
Any thoughts on tips would be greatly appreciated!
I have been using modules in my project is written with CodeIgniter.
What I have
Folders
-->application
-->cache
-->config
-->config.php (configuration file for auth, I copied the codes to config.php)
-->controllers
-->core
-->errors
-->helpers
-->hooks
-->language
-->libraries
-->auth's libraries files.
-->logs
-->models
-->modules
-->admin
-->controllers
-->auth.php
-->models
-->ion_auth_model.php
-->views
-->auth
-->login.php
-->home
-->third_party
-->views
-->assets
-->system
What the problem is
When I go to localhost/home/auth/login.php, an error message is occurred. On the screen is written
An Error Was Encountered
The configuration file ion_auth.php does not exist.
I guess the problem is about the iounauth configuration file will be moved config folder before setup. I didnt moved it to config folder. Instead of it, I copied all the codes from that file, to the config.php
So how can I solve this problem? I need to see the login screen instead of this error message. I think I should change some lines on auth.php in controller folder. Because I am using config.php instead of ionauth.php for config folder.
I've just had a quick scan of the ion_auth Library and model and the easiest thing to do would be:
Remove $this->load->config('ion_auth', TRUE); from both the library and model.
do a string replace in both the library and model:
FIND: , 'ion_auth') REPLACE WITH: )
I have done a quick scan of the files and I can't see anywhere where this would break anything but just be careful when you're doing it (maybe do it one at a time).
The above to steps should allow you to use the ion_auth config items in your config.php
Please note that I have not tested this.
Hope this helps!
I'm also facing this issue when move my web to linux server, it solved by renaming config/Ion_auth.php to config/ion_auth.php
On my local setup I have a load of different CakePHP websites. I'm using a Mac so the folder structure is something like ~/Users/cameron/Sites/sample-website and then within each of these websites I will have the typical Cake folder and App folder.
What I would like to do is have just a core cake folder and then have ALL the sites pull from that one cake core so I don't have the same stuff several times over. I have been reading some tutorials on the web: http://rickguyer.com/cakephp-one-core-many-apps/
So I have my cake folder here: ~/Users/cameron/Sites/cake-1.3/ and then my site here: ~/Users/cameron/Sites/sample-site/ and in this folder I have the usual app folder and htaccess to tell it where to find webroot etc.
Now I have edited the index.php file inside webroot like the tutorial BUT have only changed one line because I haven't moved my files OUTSIDE of the App folder like he does. So the only like I have changed is as follows:
if (!defined('CAKE_CORE_INCLUDE_PATH'))
{
define('CAKE_CORE_INCLUDE_PATH', '..'.DS.'..'.DS.'cake-1.3');
}
As far as I can tell that is correctly looking two directories up and finding a folder called cake-1.3 however it just gives a error 500?
Any ideas what the problem is? Thanks
EDIT:
Even doing this doesn't work???
Which If I echo: echo CAKE_CORE_INCLUDE_PATH; gives /Users/cameron/Sites/cake-1.3 and if I paste that in the address bar it loads up the cake folder so it's definitely the correct folder structure JUST it doesn't like looking at cake outside of the main url?
if (!defined('CAKE_CORE_INCLUDE_PATH'))
{
define('CAKE_CORE_INCLUDE_PATH', DS.'Users'.DS.'cameron'.DS.'Sites'.DS.'cake-1.3'); echo CAKE_CORE_INCLUDE_PATH;
}
You are right on the money with:
define('CAKE_CORE_INCLUDE_PATH', DS.'Users'.DS.'cameron'.DS.'Sites'.DS.'cake-1.3');
Just make sure that Users sits in root. In other words, when you go to terminal you can get to this directory by typing: cd /Users/cameron/Sites/cake-1.3
It looks like you may be on a MAC. If so, your linking is correct. Most of the time what I find is you have done a copy paste of the app directory and it does not get the .htaccess files. I would check those first. But here is a comprehensive list of what you should verify:
Make sure the host is pointing to
the correct directory
(/Users/cameron/Sites/sample-site/)
Verify mod_rewrite is in fact on.
Verify you have copied the .htaccess
file in both the
/Users/cameron/Sites/sample-site/
and the
/Users/cameron/Sites/sample-site/webroot
directories.
Confirm that the
/Users/cameron/Sites/cake-1.3/
directory has a directory called
cake in it that contains the core.
Once all of this is confirmed, you will be good as gold!
Happy Coding!
UPDATE:
When the index.php file looks for the cake core, it will look for a directory inside the location you are pointing to for another directory called cake. So in your case:
define('CAKE_CORE_INCLUDE_PATH', DS.'Users'.DS.'cameron'.DS.'Sites'.DS.'cake-1.3');
You must have the cake directory inside /Users/cameron/Sites/cake-1.3. Your directory structure will look like:
/Users/cameron/Sites/cake-1.3/cake
/Users/cameron/Sites/cake-1.3/cake/libs
/Users/cameron/Sites/cake-1.3/cake/config
/Users/cameron/Sites/cake-1.3/cake/console
etc.
CakePHP 3.0+
In CakePHP 3.0+ this configuration is moved out of webroot/index.php to App/Config/paths.php
If you have access to your php.ini, you can add the path to Cake core there. Doing it this way means you don't have to change webroot/index.php at all. Example in php.ini:
include_path = ".:/usr/local/lib/php:/home/something/phpinc/cakephp2/lib"
According to the CakePHP 2.x docs, this is the recommended way to share the Cake core (assuming you have access to your php.ini).
You can have only one cake core but you must have one app folder (containing MVC) by site.
Is this a misunderstanding of the folder structure of CakePHP?
From the docs (CakePHP folder structure):
The app folder will be where you work your magic: it’s where your application’s files will be placed.
The cake folder is where we’ve worked our magic. Make a personal commitment not to edit files in this folder. We can’t help you if you’ve modified the core.
So the cake folder shouldn't change between all of your uses, therefore you have 1 copy. You can always change some of the functionality of the core by making your own changes in the app folder i.e. extending.
There is no need to edit index.php.
Just put an alias (or link in UNIX) to your cake folder in each of your sites folder. Works perfectly. Same goes for plugins and vendors folder.
I recently downloaded cakephp-1.3.4. I set it up on my web server. I followed the advanced installation settings. My folder structure is as follows.
/common/
cakephp/
app/
etc...
/htdoc/
The /htdoc folder is the webroot; cakephp resides in the common folder.
I have configured the paths in index.php to point to this folder structure. I have the app up and running. I created a layout, the app has picked it up (along with all the css and images - all that works).
I created a posts_controller.php in cakephp/app/controllers/. Now when I try to access the following page: http://localhost/posts. I get a message that the controller cannot be found and that I should create a app/controllers/posts_controller.php (it already exists!).
Also the strange thing is using the default pages_controller works. I created an about.ctp and dropped it in app/views/pages/about.ctp. Vising http://localhost/pages/about shows up as expected.
SOLUTION:
Sam helped me solve this problem (see the long comment thread below). The problem was I had set relative paths for my ROOT folder. This messed things up. The solution is to either directly set an absolute path or call realpath with your relative path for it to be resolved into the right absolute path.
Make sure your controller class is named correctly (should be PostsController) and inherits from AppController (not strictly necessary but good practice).
When I try to generate a CRUD test for a new project I am getting a PHP Warning and a Fatal Error.
The errors relate to files that it cannot find, however, I have checked and the files are definitely there.
The error text is 'require_once(lib/model/map/QuestionMapBuilder.php): failed to open stream: No such file or directory in c:\webroot\askeet\lib\model\om\BaseQuestionPeer.php on line 547'
What details of my project should I check?
I think it's a problem with your include path.
Check it, the require_once() call is looking for lib/model/map/QuestionMapBuilder.php
But your include_path is C:\webroot\askeet\lib
Which, when resolved together into a full path, would look like this
C:\webroot\askeet\lib\lib\model\map\QuestionMapBuilder.php
So, I think your solution is to add C:\webroot\askeet to your include path.
You are generating crud for the Question model class but it doesn't seem to exist. Documentation on using the crud generator
First you must use the schema.yml file to define your database, and run
./symfony propel:build-model
to generate your model files. (this will generate lib\model\map\QuestionMapBuilder.php)
I finally tracked down the issue. In my PHP.ini files, they were setup wit the default UNIX file path settings.
Weirdly nothing had ever been broken by this incorrect configuration. Plus, everything in Symfony had worked up until now.
I have switched to Windows style file_path and all is well again.
Thanks for all the answers!