I'm at my wit's end.
I installed PhpOffice using composer on my local dev machine and it works fine.
I uploaded my app code to a remote test server, then installed PhpOffice using composer on that server.
On both my local machine and the remote server the directory structure is the same:
project/public/ (contains index.php, etc., etc.)
project/public/vendor (contains psr, phpoffice, autoload.php, etc.)
The relevant code (which is identical on local and remote) is:
<?php
namespace App\Models;
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
But when I attempt to use IOFactory, I get:
Class PhpOffice\PhpSpreadsheet\IOFactory could not be loaded
Only occurs on remote server. I am sure the problem is something dumb but I just cannot figure out what I've done wrong. Everything appears to be identical between local and remote.
Please help.
Well, it was something dumb. My remote server was using PHP version 5.6, while my local server is using PHP version 7.2. Changed the PHP version on remote to 7.2, and that did the trick.
Related
So I followed the instructions on how to use composer to install google's api client.
When I try to open a file in my web browser that only has this code
<?php
require_once 'vendor/autoload.php';
I get these errors from my hosting provider
[03-Aug-2017 23:46:22 UTC] PHP Warning: require(/home/michmarket/public_html/vendor/composer/../guzzlehttp/psr7/src/functions_include.php): failed to open stream: No such file or directory in /home/michmarket/public_html/vendor/composer/autoload_real.php on line 66
[03-Aug-2017 23:46:22 UTC] PHP Fatal error: require(): Failed opening required '/home/michmarket/public_html/vendor/composer/../guzzlehttp/psr7/src/functions_include.php' (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/michmarket/public_html/vendor/composer/autoload_real.php on line 66
I tried to make sure that all of the files API files up to date by running this in my command prompt.
$ composer require google/apiclient:^2.0
When I do, my command prompt says that all my files are up to date. Any thoughts on why I am still getting errors?
If you can't run
$ composer install
on your web server, then you need to transfer your vendor directory to your web server after running the command on your deployment server.
If your deployment server is your local machine, try to make it match the web server in terms of platform requirements as close as possible (PHP versions, you could be running newer versions locally than on the web server), or refer to https://getcomposer.org/doc/06-config.md#platform:
Lets you fake platform packages (PHP and extensions) so that you can emulate a production env or define your target platform in the config. Example: {"php": "5.4", "ext-something": "4.0"}.
Note You might want to optimize the autoloading as well, take a look at https://getcomposer.org/doc/articles/autoloader-optimization.md#autoloader-optimization.
I have created a laravel 5.0 project with php artisan serve, now i need to know how to run laravel 5.0 project run without start php artisan serve, i have already browse lot of websites no one help me..
You need to change "server.php" to "index.php" then copy ".htaccess" from public to root directory.
See: https://stackoverflow.com/a/30053989/3948755
Laravel sever Folder is "public". There is an index.php so you can run you project from there.
Suppose if you using UbuntuOS then you have to create your local server in public directory. Suppose your folder name is laravel_test then go in that directory and run some thing like this
php -S localhost:8000 -t public
If you using windows then access public folder from URL.
localhost/laravel/public
Actually it's bad practise to access folder from URL but for local its good. You also can go with host entry. Just make sure that your target folder is "public" directory.
Normally you would have WAMP/XAMPP installed. You can access Laravel project like below
localhost/laravel/public
But this is not recommended. You should create Virtual host for example
laravel.local that pints to server-root/laravel/public.
this is how you create virtual host.
Or even better go for a Laravel Homestead .
How is your .htaccess file configured?
Try with localhost/laravel/public/index.php
Use http://localhost/projectName/public
It will be work. but in case if you have another Route and you can not access that Route and get the error like " Page Not Found " then please use the following command
sudo a2enmod rewrite
Now open the http://localhost/projectName/public/yourRoute
This is a little late but still applicable, what I like to do (using ubuntu 14.x+) is put my laravel project (let's say Project1) in my var directory, so it would be in /var/Project1, then symlink the public folder to somewhere in /var/www(+/html depending on apache version).
Symlink can be done something like this:
ln -s /var/Project1/public /var/www/html
This keeps your internal files off the grid so to speak, this is untested so if I've missed anything just comment and I will amend this post.
EDIT:
Obviously if your http root is /var/www/html you can put your project in /var/www/Project1
If you have access to xampp or wampp on your operating system you can more or less configure your virtual host like in the instruction below:
https://bestin-it.com/creating-virtualhost-on-your-local-computer-to-start-simple-index-php/
This instruction shows how to run it locally on your PC, but it works generally the same on any hosting portals. In most case in payed portals you have any web panels to configure your public folder that reference to /public folder in laravel folder's structure.
I built a project using Laravel 5 on my dev machine and now I'd like to deploy it.
One solution that came to my mind is to upload everything using FTP but I guess there is a better way.
I uploaded the composer.json but I receive tons of errors.
I have ssh/root access but using GIT is not an option.
Make sure you can use composer binary on your server and you are set
upload every file except vendor folder (you may use some FTPS manager that reads git-ignore file and does not upload ignored files)
set permissions to ./storage folder (browse thru this severfault thread)
make sure your web server root is ./public
create env file (that is not going to be changed ever, until you want) and do not overwrite it with "local" env file.
$ composer install (installs everything from composer.lock)
$ composer update (updates from repositories again, do test on local before updating on production)
I have created a local copy of my remote store (Magento Community 1.6.2.0) using WampServer 2.2E:
Cleared entire Magento cache on remote site
exported remote MySql database using phpMyAdmin
tar'd up the entire remote public_html folder and downloaded to local PC
Recreated directory structure locally under C:\wamp\www\
created a new database locally (I'm using WAMPserver) with appropriate user/pass/DBname according to /app/etc/local.xml -- note: dbase host in local.xml is "localhost"
imported database with no errors
modified mage_core_config_data table's baseurl variables to both point to http://www.localhost.com/
modified local .htaccess to prevent configuration that would result in crashing as well as to modify the rewrite rule that does the 301 redirect for domain.com to www.domain.com (I changed domain.com to be localhost.com).
deleted everything in var/cache, var/session, var/tmp, and the system /tmp folder, as suggested in another Q&A
verified that WAMP has curl PHP extension enabled
So now everything loads except for the admin panel. When I go to http://localhost.com/index.php/admin and log in, the error is:
( ! ) SCREAM: Error suppression ignored for
( ! ) Fatal error: Call to undefined function curl_setopt() in C:\wamp\www\includes\src\Varien_Http_Adapter_Curl.php on line 52
I assume that curl_setopt() is defined in the curl library, and that extension is enabled in WAMPserver.. anyone know what's going on with this?
I just realized that my php version is 5.4.3. Wampserver.com offers a 2.2E package with 5.3.13, but that also doesn't work.
I got this to work only by finally trying wampserver 2.2D, which has php version 5.3.10. I used the 64-bit installer -- didn't try the 32-bit but I assume it will work.. This information is notably absent from the magentocommerce.com wiki entry on setting up Magento with WampServer.
New problem is now no page other than the home page loads (404 not found happens for all product pages and categories). This is solved by ensuring that Apache rewrites are enabled (wampserver menu->apache->apache modules->rewrite_module)
Fatal error: Call to undefined function curl_setopt()
This error mean that php5-curl is not available/activated on your system. You should be able to activate it through the wamp configuration panel.
For linux users, install php5-curl through your packet manager.
Im developing a library hand in hand with a project I'm working on in L4 and I'm doing it in a Workbench as recommended. I have set the Service Providers etc and it works fine on my local machine. However when I pust to Pagodabox, the console gives me this:
Error Output: PHP Fatal error: Class 'Coderollers\Formidable\FormidableServiceProvider' not found in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 123
Clearly, for some reason, on Pagodabox it is looking for my service provider in the vendors folder rather than the workbench folder. Does anyone know why this might be?
For a workbench package to be loaded by Laravel it expects to find an autoload.php file within a vendor directory of your package. You'll need to run composer install from your workbench packages directory to install the package dependencies and have it dump an autoload file.
Once done Laravel will be able to detect and use your package.