Pushing a Zend Application into Amazon EC2 Instance - php

I'm trying to push a zend application onto an amazon EC2 instance.
I have set up my Zend application on the server and have set up the httpd conf.
When I try to access my website through the browser, I get the following message printed:
bootstrap() ->run();
I have followed all the standard procedures and am able to see static HTML files. But when I try to access PHP files, I see a blank page.
I checked the log files but those do not return any errors.
Any idea why I'm facing this issue.
Update:
I updated my php.ini file with the zend library include_path.
Now I'm faced with the following error:
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource
matching "Jquery" not found' in /usr/share/php/libzend-framework-php/Zend/Application/Bootstrap
/BootstrapAbstract.php:694 Stack trace: #0 /usr/share/php/libzend-framework-php/Zend/Application
/Bootstrap/BootstrapAbstract.php(626):
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('Jquery') #1 /usr/share/php/libzend-
framework-php/Zend/Application/Bootstrap/BootstrapAbstract.php(586):
Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #2 /usr/share/php/libzend-framework-
php/Zend/Application.php(355): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap(NULL) #3
/var/www/html/urban-chatter/public/index.php(29): Zend_Application->bootstrap() #4 {main} thrown in
/usr/share/php/libzend-framework-php/Zend/Application/Bootstrap/BootstrapAbstract.php on line 694

Solved:
I copied the zend library from my system onto the server and changed the include_path to the new library in php.ini file and everything started working. I think there was some compatibility issues when I used another version of zend library.

Related

Error Accessing Zend Server Web-Interface, "gui directive not found: zend"

I have a problem with Zend Server (2019.0.4). When I try to access the web-based interface it gives me HTTP 500. The exact error in the php.log file is this:
[07-Jan-2022 18:49:12 UTC] PHP Fatal error: Uncaught ZendServer\Exception: gui directive not found: zend in C:\Program Files (x86)\Zend\ZendServer\gui\module\Application\Module.php:166
Stack trace:
#0 C:\Program Files (x86)\Zend\ZendServer\gui\module\Application\src\Application\Db\AbstractFactoryConnector.php(36): Application\Module::config('zend')
#1 C:\Program Files (x86)\Zend\ZendServer\gui\module\Application\src\Application\Db\AbstractFactoryConnector.php(30): Application\Db\AbstractFactoryConnector->init()
#2 C:\Program Files (x86)\Zend\ZendServer\gui\vendor\zendframework\zend-servicemanager\src\Factory\InvokableFactory.php(30): Application\Db\AbstractFactoryConnector->__construct()
#3 C:\Program Files (x86)\Zend\ZendServer\gui\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(769): Zend\ServiceManager\Factory\InvokableFactory->__invoke(Object(Zend\ServiceManager\ServiceManager), 'Application\\Db\\...', NULL)
#4 C:\Program Files (x86)\Zend\ZendServer\gui\vendor\zendframework\zend-servicemanager\src\ServiceManager.php(205): Zend\Servi in C:\Program Files (x86)\Zend\ZendServer\gui\vendor\zendframework\zend-servicemanager\src\ServiceManager.php on line 776
The weird part is that I have had a project up and running on a Zend Server already that's been around and working for over a year now, which I've obviously accessed the web-interface for before. I can still run that project locally just fine so I know the server is running but I cannot access the web interface (at http://localhost:10081/ZendServer/) to setup an additional project! Does anyone know what this error is about and how to fix it?
Ok so the answer turned out to be one of my Zend config files was corrupted. That file was the ZendGlobalDirectives file, replacing it with a co-workers copy fixed the issue for me.
Hope this points anyone else having this problem in the right direction

Where to save AWS Credentials file when using shared hosting?

I'm using Amazon's AWS PHP SDK and I installed composer on the following directory 'public_html/composer'. I am currently using shared hosting. However, I have access to the root.
When I tried using AWS's sample code I'm getting the following errors in my error_log:
Fatal error: Uncaught Aws\Exception\CredentialsException: Cannot read credentials from /.aws/credentials in /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php:691 Stack trace: #0 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php(424): Aws\Credentials\CredentialProvider::reject('Cannot read cre...') #1 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Middleware.php(121): Aws\Credentials\CredentialProvider::Aws\Credentials\{closure}() #2 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/RetryMiddleware.php(266): Aws\Middleware::Aws\{closure}(Object(Aws\Command), Object(GuzzleHttp\Psr7\Request)) #3 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Middleware.php(206): Aws\RetryMiddleware->__invoke(Object(Aws\Command), Object(GuzzleHttp\Psr7\Request)) #4 /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/StreamRequestPayloadMiddleware.php(83): Aws\Middleware::Aws\{closure}(Ob in /home2/maltaboo/public_html/composer/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php on line 691
I created my credentials files as per AWS tutorial:
[default]
aws_access_key_id = 123456789
aws_secret_access_key = abcdefghijklm
The documentation states that I must save it in this location: ~/.aws/credentials
I tried many times to create the directory .aws/credentials however I get the same error. I tried also looking for the .aws file but I couldn't locate it except the one that I just created.
Given the above where should I place the credentials file? TIA
I also had the same issue of cannot read /.aws/credentials
Mentioning my solution here for reference:
This solution is tested in aws-php-sdk version 3.173:
CredentialProvider.php uses getenv('HOME')/.aws/credentials path to load the credentials from the file.
In my case (linux shared hosting) it was empty.
So I set it to desired value using:
putenv("HOME=/absolute/path/to/folder/containing/.aws/folder")

Google\Cloud\Storage\StorageObject->downloadAsString() uncaught error

I have a PHP script that reads files from Cloud Storage. It works fine in local dev. But when it's run in App Engine standard environment, it outputs this error message:
Fatal error: Uncaught Google\Cloud\Core\Exception\ServiceException in /srv/vendor/google/cloud/Core/src/RequestWrapper.php:362
Stack trace:
#0 /srv/vendor/google/cloud/Core/src/RequestWrapper.php(206): Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(GuzzleHttp\Exception\RequestException))
#1 /srv/vendor/google/cloud/Storage/src/Connection/Rest.php(224): Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request), Array)
#2 /srv/vendor/google/cloud/Storage/src/StorageObject.php(643): Google\Cloud\Storage\Connection\Rest->downloadObject(Array)
#3 /srv/vendor/google/cloud/Storage/src/StorageObject.php(574): Google\Cloud\Storage\StorageObject->downloadAsStream(Array)
#4 /srv/modules/profile/controllers/getresource.class.php(69): Google\Cloud\Storage\StorageObject->downloadAsString()
This doesn't happen to most of the files. The file causing this issue is about 250KB. I am wondering is there some kind of size limitation with downloadAsString()?
One of the files causing this issue is https://www.justjeans.com.au/wcsstore/JustJeansAuroraStorefrontAssetStore/css/main.css?timestamp=2019070295000
The downloadAsString() method downloads the file using stream, and then casts it to a string before returning it.
Link to the SDK code
There should not be any issues with file sizes unless you are running out of memory in your PHP process.
Is there a file that causes the issue every time? If so, maybe adding that to the question would be a good idea.

How to share cakephp 3.0 while using git

I recently installed git for sharing cakephp 3.0 code but after pushing and pulling the browser seems blank then I edit .gitignore file and remove all commands excluding /tem/* because I didn't worry about security right now and then I shared my code and got this error:
Fatal error: Class 'Psr\Log\AbstractLogger' not found in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Engine/BaseLog.php on line 24
Fatal error: Uncaught RuntimeException: Could not load class Cake\Log\Engine\FileLog in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php:57 Stack trace: #0
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php(91): Cake\Log\LogEngineRegistry->_throwMissingClassError('Cake\\Log\\Engine...', NULL) #1
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(198): Cake\Core\ObjectRegistry->load('Cake\\Log\\Engine...', Array) #2
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(180): Cake\Log\Log::_loadConfig() #3
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(360): Cake\Log\Log::_init() #4
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(284): Cake\Log\Log::write(3, 'Fatal Error (1)...') #5
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(216): Cake\Error\BaseErrorHandler->_logError(3, Array) #6
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/Bas in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php on line 57
I m posting answer for my question, actually its a permission issue in Linux and therefore it doesn't allow to share all the file while using push command in git but while using it doesn't show any error but it doesn't work properly on other end.

Doctrine error when deploying symfony2 app on pagoda box

I'm getting a doctrine error after deploying my app on PagodaBox. It works fine in both dev and prod environments on my local machine but the live site returns this error:
Fatal error: Uncaught exception 'LogicException' with message 'Illegal value passed (no array or string given)' in /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php:101 Stack trace: #0 /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php(101): spl_autoload_register(NULL) #1 /var/www/app/bootstrap.php.cache(2275): Doctrine\Bundle\DoctrineBundle\DoctrineBundle->boot() #2 /var/www/app/bootstrap.php.cache(2303): Symfony\Component\HttpKernel\Kernel->boot() #3 /var/www/web/app.php(23): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #4 {main} thrown in /var/www/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/DoctrineBundle.php on line 101
The cache is cleared every time the app is deployed.
Any suggestions would be gratefully received because I'm totally stumped!
UPDATE:
I've done some more debugging and I have discovered that even in the prod environment the kernel.cache_dir parameter is set to /var/www/app/cache/dev. This means that the doctrine cache dir is being incorrectly set as it relies on this other parameter. I thought the kernel.cache_dir was set automatically depending on the environment.
I finally got this sorted. It was down to using eAccelerator as my opcode cache. It turns out that there is a bug in eAccelerator that means it can't process closures correctly. I'm now using XCache and it is all working fine.
This is the auto-loading failing in DoctrineBundle.php Line 101:
$this->autoloader = Autoloader::register($dir, $namespace, $proxyGenerator);
Your passing NULL to the $dir argument, which judging by the exception its requires either an array() or string.
You can see that the method uses $dir from the configuration variable doctrine.orm.proxy_dir (Line 64).
$dir = $this->container->getParameter('doctrine.orm.proxy_dir');`
My guess is that you have not defined this path correctly
Edit - Take a look here for Doctrine's configuration which includes the proxy_dir setting.

Categories