Here I am mapping D drive in elfinder
I am not able to open files.
Here's my code.
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => 'D:/pdf/', // path to files (REQUIRED)
'URL' => 'D:/pdf/', // URL to files (REQUIRED)
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
)
)
);
Normally browser will open only url not path. We have to convert path into url.
If you want to map a drive (D drive) create a virtual directory in XAMMP.
Add below code in httpd-vhosts.conf
<VirtualHost *:80>
<Directory "D:/pdf">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
ServerAdmin anbu#local.dev
DocumentRoot "D:/pdf"
ServerName local.dev
</VirtualHost>
Now restart your server.
modify url in blow code
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => 'D:/pdf/', // path to files (REQUIRED)
'URL' => 'http://local.dev', // URL to files (REQUIRED)
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
)
)
);
hope it will work :)
Your URL is incorrect. Please see the example in the documentation:
$opts = array(
'locale' => '',
'roots' => array(
array(
'driver' => 'LocalFileSystem',
'path' => '/path/to/files/',
'URL' => 'http://localhost/to/files/'
)
)
);
Related
I am trying to add http://elfinder.org which is the most professional php file manager on the web, i have uploaded the file in a subfolder http://example.com/admin but the connector does not work
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '../files/', // path to files (REQUIRED)
'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
)
)
);
in my web-host panel this is the address to my account
/dns/in/olympe/moderactif
but I really can't set the correct paths
Can you help me?
Is it possible to add a variable into the line in bold?
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
**'path' => '/csgo', // path to files (REQUIRED)**
'URL' => dirname($_SERVER['PHP_SELF']) . '/../files/', // URL to files (REQUIRED)
'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL)
)
)
);
changing it to this did not help
'path' => ".$folder./csgo", // path to files (REQUIRED)
thank you
It should be:
'path' => "$folder/csgo"
A slightly better way:
'path' => "{$folder}/csgo"
This clearly shows the separation of the variable from the string
Good morning,
I'm currently learning Zend 2 but already have experience in MVC. I installed the current zend2 skeleton application, which is reachable under http://learningzend.local/ on my local machine.
Now, I'm trying to understand Zends routing but I'cant reach /application/index/index. It returns 404.
Here is an excerpt from module.config.php. The only thing I changed was the type in the two latter routes, it was originally set to 'Literal' and 'Segment' without the path. The home route seems to work: when I change the action, the homepage disappears.
'routes' => array(
'home' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'index',
),
),
),
// The following is a route to simplify getting started creating
// new controllers and actions without needing to create a new
// module. Simply drop new controllers in, and you can access them
// using the path /application/:controller/:action
'application' => array(
'type' => 'Zend\Mvc\Router\Http\Literal',
'options' => array(
'route' => '/application',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Zend\Mvc\Router\Http\Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
And few lines below
'controllers' => array(
'invokables' => array(
'Application\Controller\Index' => 'Application\Controller\IndexController'
),
),
The controller is completely unchanged
namespace Application\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class IndexController extends AbstractActionController
{
public function indexAction()
{
return new ViewModel();
}
}
I tried everything. Resetted the whole skeleton app to default but it did not change anything. Hope some Zend gurus can tell me whats wrong.
For completeness my VHOST entry
<VirtualHost *>
ServerName learningzend.local
ServerAdmin webmaster#localhost
DocumentRoot /var/www/learningzend.local/public/
AccessFileName .htaccess
<Directory /var/www/learningzend.local/public/>
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Here comes....the solution!
The Apache2 setting AllowOverride in my VHOST conf does not override the same setting in apache2.conf, even if they point to different directories. So, go to
$ sudo joe /etc/apache2/apache2.conf
Change the Setting at /var/www to
AllowOverride All
$ sudo service apache2 restart
I am newbie to zend framework and i am trying to configure the zend. I was sucessfully installed zendskeleton applicaion on window 7 and XAMPP
After installation I am creating new module Album as per define in user guide. I was make all code and pages according to guide, but after that i was enable to open Album module. i got error 404 not found.
here code
application.config
return array(
'modules' => array(
'Application','Album',
),
'module_paths' => array(
'./module',
'./vendor',
),
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
),
);
module.config
return array(
'controllers' => array(
'invokables' => array(
'Album\Controller\Album' => 'Album\Controller\AlbumController',
),
),
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/album[/][:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
),
);
Module.php
namespace Album;
// Add these import statements:
use Album\Model\Album;
use Album\Model\AlbumTable;
use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;
class Module
{
// getAutoloaderConfig() and getConfig() methods here
// Add this method:
public function getServiceConfig()
{
return array(
'factories' => array(
'Album\Model\AlbumTable' => function($sm) {
$tableGateway = $sm->get('AlbumTableGateway');
$table = new AlbumTable($tableGateway);
return $table;
},
'AlbumTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Album());
return new TableGateway('album', $dbAdapter, null, $resultSetPrototype);
},
),
);
}
}
httpd-vhosts.conf
<VirtualHost *:81>
ServerName zf2-tutorial.localhost
DocumentRoot "C:/xampp\htdocs/ZendSkeletonApplication/ZendSkeletonApplication-master/public"
SetEnv APPLICATION_ENV "development"
<Directory C:/xampp\htdocs/ZendSkeletonApplication/ZendSkeletonApplication-master/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
host entry at system32
127.0.0.1:8081 zf2-tutorial.localhost
How can i handle it.
Thanks
when you point with your apache document root to C:/xampp\htdocs/ZendSkeletonApplication/ZendSkeletonApplication-master/public
you need to use in your browser this url http://zf2-tutorial.localhost:8081/album
and not like you wrote http://zf2-tutorial.localhost/ZendSkeletonApplication/ZendSkeletonApplication-master/public/album
this url points internal to a different module/location.
//edit
if this not work check your zf2 /public folder if there is a .htaccess file present otherwise use the file from the zend skeleton application here https://github.com/zendframework/ZendSkeletonApplication/blob/master/public/.htaccess
please check also your apache vhost entry if the port is equal to your windows host file port.
make sure apache ModRewrite is loaded!
Basic misconfigurations in your setup causes this error.
I don't use windows for along time but you're using both forward and backslashes in your paths. Firstly, you should find the correct directory separator for windows and stick with it. This seems problematic: C:/xampp\htdocs/foo/bar/public
You're defining a virtualhost which listens any IP address on port 81 (*:81), a system32 hosts entry which points to port 8081 as zf2-tutorial.localhost alias and trying to call zf2-tutorial.localhost/album url using port 80. Getting this kind of error pretty normal.
After completely reading the official Getting Started and Using Apache Web Server documentations, you'll easily figure out the solution.
It seems you missing a vhost entry in your webserver. This could the reason why your application doesn't resolve your request right. Check the "getting startet: A skeleton application" again, to provide a proper configuration.
You need this hostfile entry. Adding ports is not possible in this file.
127.0.0.1 zf2-tutorial.localhost
The website is now available at zf2-tutorial.localhost:81 (and not 8081, you set 81 as the portnumber in the first line of httpd-vhosts.conf)
I am using this configuration for my Elfinder to use with CKEditor.
$opts = array(
// 'debug' => true,
'roots' => array(
array(
'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED)
'path' => '../../uploads/', // path to files (REQUIRED)
'URL' => dirname($_SERVER['PHP_SELF']) . '/../../uploads/', // URL to files (REQUIRED)
'accessControl' => 'access' , // disable and hide dot starting files (OPTIONAL)
'uploadAllow' => array('image/jpg', 'image/png'),
'alias' => 'Home',
'mimeDetect' => 'internal',
'imgLib' => 'gd',
),
),
);
However, I am able to upload all the files even PHP files!! I only want images to be uploaded. I am not able to restrict the uploading. Where am I going wrong?
Add:
'uploadOrder'=> array( 'allow', 'deny' )
Without this the default policy is allow if none of them matches.
According to:
https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options#wiki-uploadOrder