Symfony 2.4 project deployment without SSH - php

I have made a small project with symfony 2.4 at my local system. I have uploaded all the project files to my shared hosting server with same directory structure and database. Only the name of my public directory is "public_html" instead of "web". I don't have SSH access to this server. When i run the website by typing the domain name then it shows blank page. I see below given error in my server's log file:
adminhelpline.com [Sun Apr 20 17:08:55 2014] [error] [client 5.10.83.33:35937] AH01215: PHP Warning: require_once(/home/sites/adminhelpline.com/vendor/composer/autoload_real.php): failed to open stream: No such file or directory in /home/sites/adminhelpline.com/vendor/autoload.php on line 5
My Autoload file looks like this:
<?php
// autoload.php #generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit48e5d1e7fa77bf3d631b331b6343761b::getLoader();
Can anyone help me to sort out the problem?

it's quite simply. what the error log tells you that the file autoload_real.php in the folder /home/sites/adminhelpline.com/vendor/composer doesn't exist.
check the structure of your folders I assume you use some sort of ftp client? the worst case try to change the autoload.php not to include that file and see what you get or just move the file to the same folder as the autoload.php and change line 5 folder structure.

Execute composer update in your local machine, and then deploy the generated vendor/ folder.
This folder will contain the dependencies and the generated autoload

Related

loading specific lib locally for php composer

I am in the process of setting up Attendize parallel to Wordpress on my webspace,
server details:
Operating System: Linux
Software: Apache/2.4.54 (Unix)
MySQL version: MySQL Community Server (GPL) v5.7.38
PHP Version: 8.0.26
all works fine, except one process with "nitmedia/wkhtml2pdf": "dev-master". when running the function _render() I get
[2023-01-18 05:51:44] production.ERROR: Error generating ticket. This can be due to permissions on vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib. This folder requires write and execute permissions for the web user
[2023-01-18 05:51:44] production.ERROR: Error message. System error /mnt/web516/c1/78/5615478/htdocs/attendize/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/lib/wkhtmltopdf-amd64: error while loading shared libraries: libgio-2.0.so.0: cannot open shared object file: No such file or directory
[2023-01-18 05:51:44] production.ERROR: Error stack trace#0 /mnt/web516/c1/78/5615478/htdocs/attendize/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/Wkhtml2pdf.php(1047): Nitmedia\Wkhtml2pdf\Wkhtml2pdf->_render()
#1 /mnt/web516/c1/78/5615478/htdocs/attendize/vendor/nitmedia/wkhtml2pdf/src/Nitmedia/Wkhtml2pdf/Wkhtml2pdf.php(243): Nitmedia\Wkhtml2pdf\Wkhtml2pdf->output()`
libgio-2.0.so.0 is missing. , no PDF output of course
since its a rented webspace, I cannot run any packagemananger or write into the root dir.
So I tried to load the missing lib from local file. The acquired .deb got unpacked and x86_64-linux-gnu contained libgmodule-2.0.so.0 which I copy to same dir as composer.json.
in the php.ini I added extension_dir = "./"to load libraries locally from same dir and extension=libgio-2.0.so.0 to load it.
when running composer I get
PHP Warning: PHP Startup: Unable to load dynamic library 'libgio-2.0.so.0' (tried: ./libgio-2.0.so.0 (./libgio-2.0.so.0: cannot open shared object file: No such file or directory), ./libgio-2.0.so.0.so (./libgio-2.0.so.0.so: cannot open shared object file: No such file or directory)) in Unknown on line 0`
if I change the location of the file and the extension_dir accordingly, I keep getting this error.
I have also tried to zip it up and let composer load it from local repository with composer.json, goes thru, but does nothing.
So how (also in what format) can I load this specific lib locally? (via php.ini, or composer integration)

Why does switching to secure folder (httpsdocs) break the PHP file upload function

Server version: Apache/2.4.34 (Unix)
NOTE: This is not a Plesk or control panel questions. This is a custom PHP application hosted on a Rackspace dedicated server with no control panel.
I'm trying to utilize an existing SSL certificate for several sub-directories of a domain, but the architecture for the domain separates out two directories for non-secure/secure:
httpdocs
httpsdocs
I copied everything from httpdocs to httpsdocs and also forced traffic to https using .htaccess. Everything worked great until I tried the PHP file upload functionality.
Here's the bit of code that is failing from the secure side:
$path = "uploaded_files/".$row_query[0].'/'.$file_name;
copy($temp_file, $path);
In doing some debugging, I found that the temp file gets created:
/tmp/phpanKT4N
but the error I see in the logs is:
copy(uploaded_files/New Sub Folder/30052_testing.txt): failed to open stream: Permission denied in /var/www/vhosts/.com/httpsdocs/demo/resource/add_resource.php on line 108
I tried changing copy() to move_uploaded_file() but here's the error for that:
PHP Warning: move_uploaded_file(uploaded_files/test/30054_testing.txt): failed to open stream: No such file or directory in /var/www/vhosts/<thedomain>.com/httpsdocs/demo/resource/add_resource.php on line 111
PHP Warning: move_uploaded_file(): Unable to move '/tmp/phpOC9YEF' to 'uploaded_files/test/30054_testing.txt' in /var/www/vhosts/<thedomain>.com/httpsdocs/demo/resource/add_resource.php on line 111
I searched stack and saw that ownership must match, but the permissions appear to be the same for httpdocs and httpsdocs.
The /tmp folder is owned by root:root and like I said this works perfectly from the non-secure folder. The non-secure and secure upload folders are identical:
httpdocs:
drwxrwxr-x+ 8 theuser apache 4096 Sep 22 2015 uploaded_files
httpsdocs:
drwxrwxr-x+ 8 theuser apache 4096 Sep 22 2015 uploaded_files
Is this a configuration, permissions issue, or what?
Figured this out... Ran the following:
First find apache's user:
egrep -i '^user|^group' /etc/httpd/conf/httpd.conf
Result:
User apache
Group apache
Then ran this and it solved all the PHP file upload issues in httpsdocs:
chown -R apache:apache /var/www/vhosts/<thedomain>.com/httpsdocs/
chmod -R g+rw /var/www/vhosts/<thedomain>.com/httpsdocs/

How write in files through TYPO3 Command Controller

I wanna create files and write in log file through a TYPO3 command controller. I have used command controller, this is registered in ext_localconf as $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = VENDOR\ExtName\Command\GeneradorArchivosEncuestasCommandController::class;; the objetctive of this command controller is to create all templates in xlsx of a surveys of my extension domain, but in the mopment to create a file or write inside log files, I have the next error: failed to open stream: Permission denied.
Otherwise, the directories has 775 permissions and owner apache as group; and the users: _cli_lowlevel and _cli_scheduler, those user have the same file mount in BE referenced to typo3temp.
I am using TYPO3 7.6, PHP 5.6, Apache 2.2.15

Fatal error: require(): Failed opening required 'C:\wamp\www\sep24\e/src/functions.php' (include_path='.;C:\php\pear')

Tried to run the trans.php program from wamp server from the path
C:\wamp\www\sep24\e\trans.php
I have included the AWS folder in
C:\wamp\www\sep24\e\Amazon\
And AWS credential file in wamp/www folder as well user directory for the access
C:\wamp\www\.aws\credentials & C:\Users\username\.aws\credentials
This is my program
<?php
define('ROOT', dirname(__FILE__));
require ROOT . '/vendor/autoload.php';
use Amazon\Aws\ElasticTranscoder\ElasticTranscoderClient;
-------------
------------
// no error here.
?>
When i'm trying to run the program, I get this error
Fatal error: require(): Failed opening required 'C:\wamp\www\sep24\e/src/functions.php' (include_path='.;C:\php\pear') in C:\wamp\www\sep24\e\vendor\composer\autoload_real.php on line 54
I have included all the packages of AWS which I downloaded from the git.
What change should I make ?
There are two main problems are:
1 Composer Autoloading
The AWS dependency needs to be downloaded with Composer,
if you want the Composer Autoloader to work correctly.
Do not move folders around, when working with Composer.
The autoloading expects the files and folders inside the vendor folder.
I have included all the packages of AWS which I downloaded from the git.
You don't need to do this manually.
2 The use statement is wrong.
Change use Amazon\Aws\ElasticTranscoder\ElasticTranscoderClient;
to use \Aws\ElasticTranscoder\ElasticTranscoderClient;
3 Example Application
Because it is your third question and you seem to have problems with the application structure in connection with Composer, i will provide a simple PHP application template to demonstrate how you work with the AWS dependency.
This example provides a basic namespaced PHP application and includes the Client class from the AWS dependency(, which you have to fetched by Composer).
You find the file over here:
https://www.dropbox.com/s/q1b406thgu3146n/php-app-composer-aws.zip?dl=0
Extract the test folder into your www folder.
Then execute a composer install and run index.php.
You will end up with a error from TranscoderClient, because it expects a configuration. Not part of the problem.
Use composer.
Create testaws directory and put composer.json file with content below (you can adjust it to your needs for example PHP version or dev packages)
{
"name": "yourname/sampleapp",
"description": "Sample app",
"require": {
"php": ">=5.5.0",
"aws/aws-sdk-php" : "dev-master"
},
}
run composer install
then in index.php in testaws directory put this line in index.php
require __DIR__ . '/vendor/autoload.php';
After you do this steps it should work. More about composer you will find there
Also you can find sample project here
Delete the vendors folder and run composer install.

Warning: failed to open stream: No such file or directory in C:\wamp\www\laravel\bootstrap\autoload.php on line 17

Environement
Windows 7
WAMP server
PHP 5.3.13
Apache 2.2.12
MySQL 5.5.24
Laravel 4.1
I installed laravel, trying to run the URL
http://localhost/laravel/public
autoload.php
define('LARAVEL_START', microtime(true));
require __DIR__.'/../vendor/autoload.php';
if (file_exists($compiled = __DIR__.'/compiled.php')){
require $compiled;
}
Illuminate\Support\ClassLoader::register();
if (is_dir($workbench = __DIR__.'/../workbench')){
Illuminate\Workbench\Starter::start($workbench);
}
I am facing the following errors:
Warning: require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\laravel\bootstrap\autoload.php on line 17
and
Fatal error: require() [function.require]: Failed opening required 'C:\wamp\www\laravel\bootstrap/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\laravel\bootstrap\autoload.php on line 17
Go to the current Project folder
C:\wamp\www\laravelProjectFolder>
and type composer install in command prompt and press ENTER key.
composer install
Then the vendor directory will be downloaded in the current project of laravel.
Now refresh the screen.
Simply make your storage folder writable. This can be found in your app directory
In your terminal use this command
chmod +w <directory> or chmod a+w <directory>
Make sure you navigate to the directory containing the directory you want to make writable or you point to that path.
go to your project folder via cmd. run the following command
composer update
it will install missing vendor folder and files in your project.
but in some cases it gives error like " Your configuration does not allow connection to bla bla bla.."
for that go to your composer.json file,
change "secure-http": true to "secure-http": false
but in some cases (as was in my case) you may not find such line in your file. for that do the following action:
change "config": {
"preferred-install": "dist"
}
to
"config": {
"preferred-install": "dist",
"secure-http": false
}
and run again composer update command.
hope this will solve problem of many persons. :)
You are trying to include:
C:\wamp\www\laravel\bootstrap/../vendor/autoload.php
and the error gives
No such file or directory in
C:\wamp\www\laravel\bootstrap\autoload.php on line 17
so you need to check your directory layout. Is there a directory vendor in lavarel with a file autoload.php in it?
and you should either have / in your pathnames or \ but not mixed both.

Categories