Configure Laravel project on a DSO handler server - php

I have a Laravel 5.0 project that I want to test on servers that supports different php handler like:-
1. suPHP (Single user PHP)
2. FCGI (FastCGI)
3. CGI (Common Gateway Interface)
4. DSO (Dynamic Shared Object)
In case of first three the project works fine.
And also I tried to move the project out of public.
But when ever I try to run the project on a DSO server it fails.
There is just:-
1. Mozila -> blank screen
2. Chrome -> 500 error
The server I have is a VPS Linux server.
And I was just changing the php handlers.
For the first three case the php handler API is CGI
and For the DSO its Apache
Please let me know what would be the appropriate solution.
This is my error log
[Fri Nov 06 11:46:20.789176 2015] [:error] [pid 1111] [client 111.111.111.111:11111] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/home/site-name/public_html/project-name/code/storage/logs/laravel-2015-11-06.log" could not be opened: failed to open stream: Permission denied' in /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87\nStack trace:\n#0 /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(88): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)\n#2 /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#3 /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Logger.php in /home/site-name/public_html/project-name/code/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87
Thank You

its just today I found the solution.
On a DSO server the file or folder permission should be set to 777 on the server.
And the exact path that gets affected due to this is Laravel-project/storage folder should have the 777 file permission. And also all the folders and files within it and more within.

Related

server,php file missing, fatal error

I have been using laravel for multiple projects already, however for some reason my new laravel project does not have the server.php file.
Reinstalling composer and / or recreating the project does not work. I also can't put a file by the name of server.php into the project in any way.
[Fri May 11 02:26:55 2018] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Fri May 11 02:26:55 2018] PHP Fatal error: Unknown: Failed opening required 'C:\Users\Luke Derkzen\Documents\GitHub\Website\server.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0
I get this error when I try to start the server, as far as I can see it's expecting me to have something running on XAMPP, however on my other projects there is a server.php file, and it doesn't give above error.
The project was created with following command:
composer create-project --prefer-dist laravel/laravel
If i use the php artisan serve command afterwards to start the server and reload the page. above error appears in the artisan console.
How can I fix this?
Server.php make a Exception and your Anti-Virus like Avast delete it Automatically. Make turn off your Anti-VIrus Software.
The problem occured, as rightly predicted by some, due to corrupt windows permissions. I talked about it with microsoft support, however they could offer no solution (without paying $50 / $150) so I did a clean install of windows.
While I'm sure this isn't a solution people hope to find, it was the only way for me.

"Failed to start the session: already started by PHP" error using a CMS

I installed a CMS, named Prestashop: it runs under a specific domain, and with a specific VirtualHost configuration on Apache, on a server with other PHP applications.
When I try to login in, as administrator user, I receive the following error (this is the Apache error log):
[Wed Jan 18 00:09:16.059190 2017] [:error] [pid 31253] [client xx.xx.xx.xx:63129] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to start the session: already started by PHP.' in /opt/wp/apps/prestashop/app/cache/prod/classes.php:108\nStack trace:\n#0 /opt/wp/apps/prestashop/app/cache/prod/classes.php(483): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()\n#1 /opt/wp/apps/prestashop/vendor/symfony/symfony/src/Symfony/Component/Security/Csrf/TokenStorage/SessionTokenStorage.php(90): Symfony\Component\HttpFoundation\Session\Session->start()\n#2 /opt/wp/apps/prestashop/vendor/symfony/symfony/src/Symfony/Component/Security/Csrf/CsrfTokenManager.php(54): Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage->hasToken('ANONYMOUS_USER')\n#3 /opt/wp/apps/prestashop/app/cache/prod/classes.php(8196): Symfony\Component\Security\Csrf\CsrfTokenManager->getToken('ANONYMOUS_USER')\n#4 /opt/wp/apps/prestashop/classes/Link.php(722): PrestaShopBundle\Service\Routing\Router->generate('admin_product_c...')\n#5 /opt/wordpre in /opt/wp/apps/prestashop/app/bootstrap.php.cache on line 3216, referer: http://www.xxxxx.xx/adminXXX/index.php?controller=AdminLogin&token=181fa270d47386a8d523bdea6213932c&redirect=AdminDashboard'
PHP session auto_start parameter is set to 0 in php.ini.
I don't understand how can I solve this problem. It can be depends on an Apache or PHP configuration?
Thanks a lot.
I Just got the same issue with my Symfony 3.2 app, i was upgrading my web server from php 5.5.12 to php 5.6.31 when it happened. After upgrading again to php 7.0.23 everything go back to normal.

Installing Laravel 5 on shared cpanel hosting

I followed This tutorial for installing Laravel 5 on a shared cpanel hosting. Everything went smooth, but I get an error when I open my website:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator at webmaster#naxon.co.il to
inform them of the time this error occurred, and the actions you
performed just before this error.
More information about this error may be available in the server error
log.
Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request. Apache/2.4.18
(Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 Server at naxon.co.il
Port 80
This is how my log file looks like:
[Sat Apr 09 00:36:06 2016] [error] [client *] SoftException in Application.cpp:256: File "/home/naxond/laravel/public/index.php" is writeable by group
[Sat Apr 09 00:36:06 2016] [error] [client *] Premature end of script headers: index.php
Any ideas?
Change the file permissions from '0664' to '0644'. It's complaining because that file (or folder) is writable by group and needs corrected to more secure permissions.
Before upload your project, you must to be sure that the server match the following requirements:
PHP >= 5.5.9
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
As you can see in your logs, all the erros are related with the server requirements:
Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/php_mbstring.dll' you don't have Mbstring PHP Extension installed.
Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/php_openssl.dll, you don't have OpenSSL PHP Extension
and so on.
You can check all the laravel requirements in their documentation.
Laravel 5 DOC
Anyway, you can try to install the libraries if you have full access to the server.
Regards!
Change public/index.php file permissions from 0664 to 0644

Access Telegram-CLI using php

I want to access the Telegram-CLI using PHP.
I'm compiled Telegram-CLI and loged in to my account, and its works like a charm.
I installed LAMP ([in Linux], Apache, MySQL, PHP) and i tested them works.
I even installed these [following] PHP packages one-by-one using "Composer" and tested the examples but i couldnt make them run...
Also it seems their forum are abandoned to get my questions answer.
php-client for telegram-cli
A wrapper for Telegram-CLI
PHP Wrapper and Drupal module using Telegram CLI
Could somebody tell me how to make one of them work in simple way.
All steps of building Telegram-cli, loging in for first time and run it as deamon has beed completed.
For Example:
This project has been installed on php project root dir using "Composer".
Example.php file has been moved to web server root directory.
But also unning it cause a 500 Internal server error.
The error line is:
$telegram = new \Zyberspace\Telegram\Cli\Client('unix:///tmp/tg.sck');
notices:
The file has been checked and is already there.
And the telegram-cli is running as a daemon on root user.
I added a telegramd group and telegramd user assigned to that group.
I detacted that php commands running under apache user account.
I changed the apache user group to telegramd.
But again nothing...
So, Please help me
Edit:
I changed the httpd.conf user and group parameters to run at the same (telegramd) account
User telegramd
Group telegramd
And i have restarted the apache and checked the username by
exec('whoami');
The Apache is running under "telegramd" user account.
But nothing again..
Edit 2:
error_log file:
[Wed Feb 10 11:02:04.251133 2016] [:error] [pid 1172] [client 10.0.1.24:49168] PHP Warning: stream_socket_client(): unable to connect to unix:///tmp/tg.sck (No such file or directory) in /var/www/html/vendor/zyberspace/telegram-cli-client/lib/Zyberspace/Telegram/Cli/RawClient.php on line 48
[Wed Feb 10 11:02:04.251332 2016] [:error] [pid 1172] [client 10.0.1.24:49168] PHP Fatal error: Uncaught exception 'Zyberspace\Telegram\Cli\ClientException' with message 'Could not connect to socket "unix:///tmp/tg.sck"' in /var/www/html/vendor/zyberspace/telegram-cli-client/lib/Zyberspace/Telegram/Cli/RawClient.php:51\nStack trace:\n#0 /var/www/html/example.php(10): Zyberspace\Telegram\Cli\RawClient->__construct('unix:///tmp/tg....')\n#1 {main}\n thrown in /var/www/html/vendor/zyberspace/telegram-cli-client/lib/Zyberspace/Telegram/Cli/RawClient.php on line 51

AWS Elastic Beanstalk - PHP script fails to execute after deploying new version

I am using AWS Elastic Beanstalk for PHP which manage 1 EC2 linux server with Apache web server.
When deploying a different version (zip file with all my php scripts) through the management console i sometimes run into a weird situation.
In some cases, even if i am deploying a version with exactly the same scripts which all worked before, some of them suddenly aren't working. When deploying another version again (still same scripts, same content), suddenly everything is working as normal.
Example of a problematic service :
<?php
// dynamically loads needed classes
function __autoload($class_name) {
include $class_name . '.php';
}
$response = new Response();
$response->data = array('platform_version' => Configuration::PLATFORM_VERSION);
die(json_encode($response));
?>
Normally, this script returns a json object. After changing nothing and deploying a version this scripts returns nothing. Is there a way to find if an error occurred?
BTW, i can see a call to the service in the application_access_log of Apache with return status 200.
EDIT:
After changing the error level on the web server i started to see interesting information in the application_error_log :
*[Mon Nov 05 17:19:44 2012] [error] [client 10.210.159.209] PHP Fatal error: require_once() [function.require-once]: Cannot redeclare class response in /var/www/html/InstallerLog.php on line 12
[Mon Nov 05 17:19:44 2012] [error] [client 10.210.159.209] PHP Stack trace:
[Mon Nov 05 17:19:44 2012] [error] [client 10.210.159.209] PHP 1. {main}() /var/www/html/InstallerLog.php:0*
Why am i getting this error?
I am using :
require_once 'Response.php';
In my script so this kind of error should not occur for my knowledge...
OK. So eventually it was pretty basic.
The error occurred because the class name i was using, "Response", was already in use in other place (not in my code, maybe in the SDK or something like that).
After changing the name to something less generic the error didn't happen again.
Just for play safe i have also added :
if(!class_exists('MyNewResponse'))
before creating the class.

Categories