if my main.php file is located inside /wp-content/plugins/myplugin/folder/folder/folder/
why including urls.php , located inside /wp-content/uploads/folder/ doesn't work with this path:
include_once("../../../../../uploads/folder/urls.php");
it works only if placed inside same folder as main.php with path ('urls.php');
you can use content_url() it's located with http://www.example.com/wp-content wp-content folder.
Or for path
you can use WP_CONTENT_DIR it'll located to wp-content folder.
require_once(WP_CONTENT_DIR. 'uploads/folder/urls.php');
Check more info Documentation
It seems strange. Do you have any error message when you run your main.php?
Try to check again, maybe a typo somewhere. Do you take help of Text editor auto-completion when calling urls.php?
Related
I am trying to install Laravel 5.3 in sub domain /public_html/mysite
but it's not working should I change .htaccess or what ?
Put the content of public (L5) directly on public_html (be aware of don't overwrite the .htaccess file accidentally) Now in then modify your index.php and your bootstrap.php and it will work just fine
I hope #Nino Armani gave you the right answer. Although you can try with visual video tutorial here-
http://www.tisuchi.com/upload-laravel-projecy-cpanel/
Move everything from project/public folder to project/ folder
Update index.php to have bootstrap path like "./bootstrap"
Add base APP_URL in your .env
Update layout folder paths like {{URL::to('/css/app.css')}}
I have a file structure that looks like this (unimportant files left out):
Testserver
-file.php
PHP
-functions.php
Administration
-index.php
Now when I try to call require_once('../PHP/functions.php'); inside the "index.php" it doesn't work and I don't understand why. Anyone an idea what the problem could be?
This works fine:
require_once('../file.php');
first thanks for all the answers, I found the bug now:
inside the functions.php I require another file and the path to that file wasn't correct when I called it from index.php
So I had to change the path inside functions.php not inside index.php.
Still thanks to everyone for the other suggestions :)
Do you get an PHP error, and if what does it say?
Check for lowercase/uppercase problems
The following should work correctly:
require_once('../PHP/functions.php');
Check your privileges on the folder and try:
require_once('../PHP/functions.php')
You have a Folder Structure Like so:
Testserver
-file.php
PHP
-functions.php
Administration
-index.php
And then, you are inside of index.php trying to Access the File functions.php, which lives inside of the Directory PHP. Then you need to go up one Directory from the current directory of the index.php File (ie. The Administration Directory) [meaning that you get up to Testserver Folder from theAdministration Folder] and then drill down to the PHP Directory. In code this would mean:
<?php
require_once __DIR__ . "/../PHP/functions.php";
Hope this does it for you.
Cheers & Good Luck....
I am trying to define the wordpress upload folder outside the installation directory. My directory structure is:
/path/to/my/base/folder
|-> wordpress (the wordpress installation)
|-> uploads (the required upload folder)
I have tried defining the 'UPLOADS' in my wp-config.php like:
define('UPLOADS', '../uploads');
Wordpress creates the folder and the images are uploaded there, but cannot use it when required. The image URL looks like :
www.myhost.dev/../uploads/image-file-name-format.jpg
But if I use absolute path to define the 'UPLOADS' like
define('UPLOADS', '/path/to/my/base/folder/uploads');
this works.
But the problem is, then the image url looks something like:
www.myhost.dev//path/to/my/base/folder/uploads/image-file-name-format.jpg
This tells the location of the file and this can be a security issue.
So, is there a better way to define the relative path for the uploads folder which will point to my required folder?
Thanks in advance.
I have done it at last by making a symlink with proper permissions. In my case, when I tried to make a symlink, the symlink did not have enough permission to write into the folder. This was because of my system (I am using Macbook). So what I did is:
$ cd wp-content
$ mv uploads /path/to/my/base/folder/
$ ln -s ../../uploads uploads
$ chmod -h 777 uploads
Check the last line where I have changed the permission for the symlink. Normally in most of the cases, you don't need to change the permission of the symlink, as they inherit the permission of the folder.
A couple of notes that may help people:
define( 'UPLOADS' , 'blah') is typically RELATIVE to the WordPress core root directory. The default is 'wp-content/uploads'. If you try to put the uploads outside of the WordPress directory with something like '../uploads/' as the define the upload URL will typically not work causing problems.
If you set the path with the define() inside your wp-config.php WordPress will NOT read the upload_path setting, if you have used it.
I found that setting the upload_path option in WordPress is better for storing media files outside the WordPress install path. Login to your WP Admin and go to the url /wp-admin/options.php to see the "raw" options list for WordPress.
Look for the upload_path setting. Put in your FULL PATH on the server like /usr/wpsite/uploads/ where /usr/wpsite/public_html would be where your WordPress core install typically ends up. Save the settings.
Your uploads will now be placed OUTSIDE the WordPress install directory. Make sure the web server has read/write permissions to the directory.
Also note that WordPress will put ALL FILES in that directory. It will not separate them into year/month subfolders as is the default for a typical WordPress install. If someone knows how to retain that feature please comment.
If you take a look at this link http://www.wpbeginner.com/wp-tutorials/how-to-change-the-default-media-upload-location-in-wordpress-3-5/
You need to use a path like so
define( 'UPLOADS', ''.'uploads' );
I have a user_ip_location.php file in "/user/files/new" folder.
full url to the file is
/user/files/new/user_ip_location.php
I want to include this file to profile.php file that is located in Root dir
I have tried the following code
include("/././user_ip_location");
and
include("http://example.com/user/files/new/user_ip_location");
Both are not working, first is returning no such file or directory and the second is not loading the page and the browser is returning error could not locate to remote server
Is there any way to fix it?
You need to indicate previous directory by double dots ..
include("../../user_ip_location.php");
If I understand your question correctly you are in some directory and want to include a file from /user/files/new/user_ip_location.php. So just including it by specifying the path should do the trick.
In your example this would be:
include("/user/files/new/user_ip_location.php");
If the file you want to include is levels above your current directory just specify this by using .. like include("../../user_ip_location.php");
Try this:
include './files/new/user_ip_location.php';
How to call css or js file from
/app
/webroot
/bootstrap
/bootstrap.css
if i added
echo $this->Html->css('bootstrap');
code in view/Locale/default.ctp its working fine .. but bootstrap.css file not taking from bootstrap folder .
If i copied bootstrap.css in webroot/css folder its working fine ..
I am fresher for cakephp . Can anyone help me to resolve issue
The path that you provide in $this->Html->css() is the path of webroot, If you have a sub-folder under webroot, and the css file is in the sub-folder,you have to specify the sub-folder name, like this:
$this->Html->css('bootstrap/bootstrap');
use this hope this Help
$this->Html->css('/bootstrap/bootstrap');