I am installing zend framework 2 on my shared hosting server. So far I did the steps below.
downloaded the ZF2 skeleton application and uploaded to my public_html. I have config, data, module, public, vendor, and init_autoloader.php in "public_html" folder on my server at this moment.
downloaded the full package (ZendFramework-1.12.9) and copied "library" folder and placed it under public_html/vender/ZF2/ so that it would work in init_autoloader.php
created .htaccess in which I entered below:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !.(js|ico|txt|gif|jpg|png|css)$ index.php
created index.php and placed it under public_html/. The content is below:
<?php
define('RUNNING_FROM_ROOT', true);
include 'public/index.php';
?>
I opened a browser and ran the url (pbm.pbmarketing.ca).
I have got a fatal error message below:
Fatal error: Class 'Zend\Loader\AutoloaderFactory' not found in /home/pbmarket/public_html/pbm/init_autoloader.php on line 44
What step did I do wrong? Could you please help me with this issue?
Once you have the skeleton app, use Composer to install ZF2 (see the instructions here: http://framework.zend.com/manual/2.3/en/ref/installation.html). Since you're on shared hosting you may need to do this before uploading the files. You don't need to do download ZF itself (and not ZF1!)
I've not used ZF2 on shared hosting, so can't help you with that side of it, but the error you're currently getting is because you don't have any of the ZF2 files.
Related
This is the first time I am developing a Laravel Vue app. When I use php artisan serve, everything works fine. But when I load it with http://localhost/myProject/public, assets are not loaded. My images are in img directory inside public folder. I was using blade templating to manage this issue when I use Laravel alone. But now I can't use blade since it is a Vue component. How can I run the project without php artisan serve? My Ultimate aim is to deploy the project in godaddy shared server. Please help me.
Debug your application using 'php artisan serve' while you develop from your local machine.
When you publish it into godaddy,
compress the project folder (say 'my_project') and upload the zip file ('my_project.zip') to 'public_html' directory in godaddy.
unzip the folder.
Now the directory structure will be 'public_html/my_project...'
you will have a 'public' directory inside 'my_project'.
Now create a subdomain which points to the 'public' directory.
That's it. Now load the subdomain.
The assets and api's will work perfectly.
just rungit clone [your_project_address] in the www folder and then run 'php artisan migrate', of course, you should have configured well.
#ThasheelApps this is your solution to access api's.
Create a .htaccess file in root folder and paste the following code there:
<IfModule mod_rewrite.c>
Options +FollowSymLinks -Indexes
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
This issue occurs many times due index.php in url. if you try your api endpoint including index.php, it will work perfectly. to prevent this issue we need to follow above soution htaccess
Follow these steps:
zip your project after npm run dev and php artisan serve without
any error.
Go to your shared hosting location and outside fo public_html
make a folder name say myproject. Inside this folder extract all
your project files.
cut your public folder from project folder on root, go to your
subdomain folder under public_html and paste.
go to index.php inside public folder and
require DIR.'/../vendor/autoload.php'; and
$app = require_once DIR.'/../bootstrap/app.php'; pointing to your project location on root.
That is all. Enjoy, if you have properly created and attached your DB to your project.
I'm trying to setup laravel (5.4.12) in shared hosting. Following this tutorial I had deleted my public_html and created soft-link for public_html to public folder of laravel project. I had successfully setup laravel (5.3.29) following the same tutorial for my previous project. But this time when I try to open base url it downloads index.php file of public directory of laravel folder. Can anyone help me out.
You can do it without deleting public_html folder.
for routing to public forlder just add these lines to .htaccess files
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
Normally PHP files are downloaded when the web server isn't configured to serve PHP files. Sounds like you need to talk to your hosting provider.
Finally found the solution. The issue was with PHP version. I had selected PHP version 7.1.0RC4,I changed it to 7.0.12 and the problem is gone.
Laravel 5 setup without artisan serve command
Rename the server.php in the your Laravel root folder to index.php
copy the .htaccess file from /public directory to your Laravel root
folder.
I make a fresh setup of laravel on localhost (/var/www/html/) with command composer create-project laravel/laravel moduleTesting --prefer-dist.
Then I move all the files inside folder to (/var/www/moduleTesting/setup), then move all the files from public folder(/var/www/moduleTesting/setup/public) to moduleTesting folder(/var/www/html/moduleTesting).
I changed bootstrap file path in index.php file placed in moduleexample.dev folder(/var/www/html/moduleTesting/).
require DIR.'/setup/bootstrap/autoload.php';
$app = require_once DIR.'/../../laravel_setup/bootstrap/app.php';
I also set the permission of folder /var/www/moduleTesting/setup/bootstrap/cache and /var/www/moduleTesting/setup/storage
Then I run command composer dump-autoload in terminal at (/var/www/moduleTesting/).
Then I try to run URL in the browser, and I see the welcome page of laravel app.
Then I install module package caffeinated/modules
Begin by installing the package through Composer.
composer require caffeinated/modules
Once this operation is complete, simply add both the service provider and facade classes to project /var/www/html/moduleTesting/setup/config/app.php file:
Service Provider
Caffeinated\Modules\ModulesServiceProvider::class,
Facade
'Module' => Caffeinated\Modules\Facades\Module::class,
After successful installation, I create a new module by command
make:module Admin and follow easy steps steps and it created successfully and run by hitting URL http://localhost/moduleTesting/admin'.
Issue
Now the problem is when I run URL.'http://localhost/moduleTesting/admin'
it runs successfully but when i run 'http://localhost/moduleTesting/admin'(add '/' only at the end of the same url) it does now work and redirect me to url 'http://localhost/admin'
Does anybody know, please help me how to solve this issue, On the same node if upload the setup on the server in a inner folder and run the same url it also redirect me.
This is probably because .htaccess redirects trailing slashes to an URL without a traling slash.
In this section in your .htaccess file, Apache redirects everything with a trailing slash - if not a folder - to its origin. This causes trouble, because the public of the project is located at a directory.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
Replace the second rule with:
RewriteRule ^(.*)/$ /moduleTesting/$1 [L,R=301]
Note: it is better not using a directory as your public destination because these kinds of problems occur. You should be better of creating a fake local domain, like: module-test.dev or something.
I am installing Yii2 on a shared hosting environment,Apache, (Godaddy),
here is what I did as per the docs:
Renamed web folder to www
copied all the folders, now the directory structure looks like this:
public_html\
assets
commands
config
controllers
model
modules
views
www\index.php
.htaccess (this is both in public_html and www)
but when I access my domain, I get the following error:
You don't have permission to access / on this server. Additionally, a
404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.
Here are the contents of my .htaccess which I have copied in both public_html and www.
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
is the htaccess creating problem? Is index.php not being run from the right folder? What else should I look for? any help is much appreciated.
Update:
The actual problem with the above error was that It was a Permissions issue.
Set the permissions from 644 to 755, and now the system is accessible.
BUT
the to access index.php I still need to navigate to it manually by typing in the url : www.example.com/www/index.php
UPDATE
As I don't have prettyurl's enabled, just to make it work, I deleted all the contents of the .htaccess, then I copied the contents of basic folder in the home folder (for future visitors it should be like home/your_user _name
CAVEAT EMPTOR
I know almost nothing about .htaccess. Also my this project is just for learning, this solution may not be useful in production settings.
Question is still open for expert advice on best practices in such scenario.
You need to move your domain pointer to www instead of htdocs, its probably somewhere under domain -> root folder. Your .htaccess looks fine.
I have freeBSD installed on IBM server. There is also apache, php and mysql installed on the server. A PHP application running on this machine is working just fine, but our new version of the same application developed in Codeigniter gives a "Page Not Found" error.
The thing is the application is accessible and runs well (only the non-english character are displayed not well) if the index.php is included in the url.
I have modified the file .htaccess to remove the index.php from the url, I kind of need to use the .htaccess in the application's root directory. This (using .htaccess) is actually causing the error.
Please let me know what configuration do I need to do.
Edit:
Bellow is the content of .htaccess in the root directory of the application:
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ /football/index.php/$1 [L]